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
can any body body expalin best definitions & best real time exaples for opps concepts.
What does this () mean in java?
Which sorting is best in java?
How does a cookie work in Servlets?
What is the difference between static and global variables and also define what are volatile variables?
Can we use both this () and super () in a constructor?
What is Garbage Collection in Java
Is 9 a prime number?
When to use runnable interface vs thread class in java?
What is ++ a in java?
how to create multithreaded program? Explain different ways of using thread? When a thread is created and started, what is its initial state? Or extending thread class or implementing runnable interface. Which is better? : Java thread
How many bytes is 255 characters?
What is static import in java?
What is the difference between math floor and math round?
What is private protected in java?