what is mutability?which one is mutable String or StringBuffer?and why?give
examples of each which shows the mutability of each String or StringBuffer
Answer Posted / surya simhadri
Mutability means which can be changed. StringBuffer is a
mutable bcoz the contents of the SB object we can change,
it can't create new reference location even though we
change the value it already referenced. But in case of
String it reference location is changed every time if u
change the content.
| Is This Answer Correct ? | 58 Yes | 2 No |
Post New Answer View All Answers
What is the Scope of Static Variable?
What is an array length?
How do you check if two strings are equal in java?
What is the size of an array?
Can an interface extend a class?
What is super keyword explain with example?
Explain access specifiers?
Explain importance of throws keyword in java?
What is a line break example?
Is it possible to define a method in java class but provide it’s implementation in the code of another language like c?
How do you represent a space in regex java?
What do you mean by stack?
What is package protected in java?
What does a method signature consist of?
Can we use string in switch case in java?