Computer Applications
A String object cannot be modified after it is created. (T/F)
Java String Handling
23 Likes
Answer
True
Reason — The string objects of Java are immutable i.e., once created, they cannot be changed. If any change occurs in a string object, then original string remains unchanged and a new string is created with the changed string.
Answered By
20 Likes
Related Questions
The length of a String object s1 can be obtained using the expression s1 length. (T/F)
Which of the following methods belong to the String class ?
- length()
- compareTo()
- equals()
- substring()
- All of these
- None of them
Given the code
String s1 = "yes" ; String s2 = "yes" ; String s3 = new String(s1) ;Which of the following would equate to False ?
- s1 == s2
- s3 == s1
- s1.equals(s2)
- s3.equals(s1)
Suppose that s1 and s2 are two strings. Which of the statements or expressions are incorrect ?
- String s3 = s1 + s2;
- String s3 = s1 - s2;
- s1.compareTo(s2);
- int m = s1.length( );