Monday 16 March 2015

Q 09) What Are Mutable And Immutable Objects ?




Mutable Objects : 
          
          When you have the reference to an object and if the reference of the object can be altered it is known as Mutable Object.
A Mutable object is a kind of object whose state can be modified after it is created.

Eg : String Buffer.

Immutable Objects : 

           When you have the reference to an object  and if the reference of that object if it cannot be altered it is known as Immutable Object.
An Immutable object is a kind of object whose state Cannot be modified after it is created.
          Eg: StringByteCharacterDoubleFloatIntegerLong,

                Short, and  Boolean are immutable classes in Java

No comments:

Post a Comment