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


Please Help Members By Posting Answers For Below Questions

Why hashcode is used in java?

508


When will we use them?

605


Can we use different return types for methods when overridden?

571


Is empty in java?

588


What does indexof return in java?

547






What is a control variable example?

540


What are invisible components?.

1686


List out benefits of object oriented programming language?

493


Is java call by reference?

540


Compare Mutex and Semaphore in java.

568


Explain oops concepts in detail?

590


Explain purpose of sleep() method in java?

628


What is argument in java?

552


What is unicode datatype?

536


What are predicates in java 8?

545