String is immutable.it is true
String can be change to mutable How?
Answers were Sorted based on User's Feedback
Answer / manoj
immutable means once created an object that cannot be changed.
if we want to change means it will create another object
that is mutable
Is This Answer Correct ? | 7 Yes | 0 No |
Answer / trupti
use string buffers..
String buffers support mutable strings
Is This Answer Correct ? | 7 Yes | 1 No |
Answer / sharief
Yes,String is immutable.The simple meaning of immutable is
unmodifiable or unchangeable.once String object has been
created,its value can not be changed.
The Reason is java uses concept of String literal.Suppose
there are 5 reference variables,all referring to an object
called "Ronaldo".If one reference variable changes the value
of the object,it will be affected to all the reference
variables.That is why String objects are immutable in java.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ilavarasan
String uses special type of memory in heap is known as
String constant pool.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / 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 |
Answer / prathap
Because of String pooling String is immutable. Using StringBuffer we can change it as mutable. i.e.,This string literal reference is assaigened to StringBuffer object
Eg : String s="java";
StringBuffer sb= new StringBuffer(s);
Is This Answer Correct ? | 0 Yes | 0 No |
a US company has filed my H1B visa ,, and i got selected in random number process.I wanna ask Could they ask regarding my languages(java,c++) or there will b just general questions?? And wat kind of questions will they ask in embassy interview??
if i know the lenght of collection in hand, should I use Array or Arraylist? justify
Do I need to import javlang package any time? Why ?
What restrictions are placed on the location of a package statement within a source code file?
what are design patterns in java?give with example?
How to send a request to garbage collector?
Why doesn’t the focus feature on the tag work in every circumstance?
I wantr to know, How many number of users logged in to website? can any one answer
what is the port number of RMI?
Write a java program to find out the sum of harmonic series : 1 + ½ + 1/3 + ……… up to nth term , for any value of n.
Is the session factory thread safe?
What is the purpose of the wait(), notify(), and notifyall() methods?