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 the kinds of polymorphism?
How many bytes is a char in java?
Enlist few advantages of inheritance?
What are default methods ?
What is a vector in java?
What does null mean in java?
What is the purpose of the wait(), notify(), and notifyall() methods in java programming?
What do you mean by synchronized non access modifier?
When is the finalize() called?
What are the restrictions that are applied to the java static methods?
When will we prefer to use set and list in java and why?
How many digits is int32?
What is public static?
What do you understand by classes in java?
Explain the hierarchy of java exception classes?