What is mutable object and immutable object?



What is mutable object and immutable object?..

Answer / Hemlata Mishra

A mutable object is an object whose state can be changed after it is created. For example, a StringBuffer in Java is a mutable object because you can modify its contents by calling methods like append(), insert(), delete() etc. An immutable object, on the other hand, cannot be modified once it's created. A String in Java is an example of an immutable object.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is hash code collision?

1 Answers  


What are the classes of java?

1 Answers  


What is the difference between the boolean & operator and the && operator in java programming?

1 Answers  


How to use scanner in java?

1 Answers  


Which arithmetic operations can result in the throwing of an arithmeticexception?

1 Answers  


How do we access static members in java?

1 Answers  


What are 3 data types?

1 Answers  


Are true and false keywords?

1 Answers  


What is string [] java?

1 Answers  


what is purpose of writting public static void main(Strind arg[]) in java..?

4 Answers   ITC Infotech,


When wait(), notify(), notifyall() methods are called does it releases the lock or holds the acquired lock?

1 Answers  


Which of these methods belong to Thread & Object class? join, yield, sleep, wait, notify

3 Answers   Ericsson,


Categories