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


Please Help Members By Posting Answers For Below Questions

What if the static modifier is removed from the signature of the main method?

717


How substring() method of string class create memory leaks?

562


What is bean? Where can it be used?

585


What is message driven beam?

589


What is clustering? What are the different algorithms used for clustering?

586






Should synchronization primitives be used on bean methods?

560


how to use debug in my elipse to solve problems that exist in my project

1772


Is the session factory thread safe?

690


What is meant by method chaining?

671


What is a policy?

1782


Why a client should be multithreading? Explain.

609


hi friends, i have done my BE(CSE)at 2011 then i have joined one company before they asked me 50k so i paid but now they telling no project here so we r going to close like that so now i need any job i have good knowledge in core java and j2ee(jsp,servlet,jdbc) so if u know any job pl help me

1792


What is the diffrence between a local-tx-datasource and a xa-datasource? Can you use transactions in both?

576


How a component can be placed on Windows?

2278


Can you control when passivation occurs?

608