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
Explain the pointers in Java?
Explain the importance of finalize() method.
If an application has multiple classes in it, is it okay to have a main method in more than one class?
how we can make a read-only class in java?
Why stringbuilder is not thread safe in java?
Is it possible to use Semaphore/ Mutex in an Interrupt Handler?
What is the purpose of java?
Is array primitive data type in java?
What is connection class in java?
Can we override protected method in java?
What is the multi-catch block in java?
Can we override the static methods?
What is finalize method?
In Java list the methods that can be overridden?
what do you understand by the term string with respect to java?