String is immutable.it is true
String can be change to mutable How?
Answer Posted / java
String s = "PROJECT";
String s2 = s.toLowerCase();
System.out.println(s.equals("PROJECT")); // Prints true
System.out.println(s.equals(s2)); // Prints false
In comparison, consider what would happen if Strings were mutable.
MutableString ms = "PROJECT";
MutableString ms2 = ms.toLowerCase();
System.out.println(ms.equals("PROJECT")); // Prints false
System.out.println(ms.equals(ms2)); // Prints true
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
what are memory considerations of jsp compares to other web components?
Difference between DurableSubscription and non- DurableSubscription?
Why are some of the class and element names counter-intuitive?
What are the difference between RMI and CORBA?
What is threadfactory?
Brief description about local interfaces?
What is the difference between the session.update() method and the session.lock() method?
How would you detect a keypress in a jcombobox?
To what value is a variable of the string type automatically initialized?
Why do I get a duplicate name error when loading a jar file?
What is jboss?
Describe responsibilities of Activator?
What is a modular application?
How are the elements of a cardlayout organized?
What are the benefits of detached objects?