When you say String is immutable, what do you mean by that?
Say I have String s = "Ness"
s= s+"Technologies";
What will happen? If the value gets appended, then what is
the meaning of immutable here?
Answer Posted / bln
Every time a new String objects gets created in this case,
but if assigned value is not same. If assigned, value is
same, then it points to same memory location, even if it is
another variable. For ex;
String s="Test";
String s2="Test";
Now s, s2 points to the same memory location.
| Is This Answer Correct ? | 20 Yes | 2 No |
Post New Answer View All Answers
What are drawbacks of singleton class?
What is the SimpleTimeZone class?
What is default exception handling in java?
What is the difference between yielding and sleeping?
Is stringwriter thread safe?
Can a list be null in java?
What are the 7 types of characters?
I want to persist data of objects for later use. What is the best approach to do so?
List types of storage classes in java?
What are thread priorities and importance of thread priorities in java?
How to use Media tracker Class.
How will you serialize a singleton class without violating singleton pattern?
What is an iterator java?
How is a structure different from array ?
What java ide should I use?