String is a immutable objects . it means that string does
not change...........
But it will be chang.........
{
String s="kapil";
String s1="raj";
String s=s1;
then print(.......)
The String has been changed ..
how it is possible and why its called immutable objects
Answer Posted / ramaraju
hi
String is a Immutable object,that is
string is an object not a datatype variable.
From the above example
String s=s1 //means it will create a new objet s with the
value raj,not change the value.
Note:whenever u edit or concatinate the string internally
it will create a new object,but not chang that object.
| Is This Answer Correct ? | 16 Yes | 4 No |
Post New Answer View All Answers
Whats the difference between notify() and notifyall()?
What is a void method?
How can we create a thread in java?
Explain enumeration in java?
Similarity and difference between static block and static method ?
How is string immutable in java?
How would you format a date in java? I.e. In the ddmmyyy format?
What are peerless components in java programming?
How many types of gc are there in java?
If a method is declared as protected, where may the method be accessed in java programming?
When do we need to use internal iteration? When do we need to use external iteration?
Does printwriter create a file?
What happens when you add a double value to a string?
What is a parameter used for?
What is a stack class in java ?