Mutable and Immutable objects

What is String?, Declare String Variables, Compare Strings, Concatenate Strings, Read Data and Covert String type data to Integer type and Double Type.
Post Reply
swathi
Posts: 134
Joined: Fri Nov 23, 2018 2:52 am

Mutable and Immutable objects

Post by swathi » Thu Dec 06, 2018 5:39 am

What do you mean by mutable and immutable objects?

manoj
Posts: 87
Joined: Fri Nov 23, 2018 5:29 am

Re: Mutable and Immutable objects

Post by manoj » Thu Dec 06, 2018 5:40 am

Immutable objects are like constants. You can’t modify them once they are created. They are final in nature. Where as mutable objects are concerned, you can perform modifications to them.

[quads id=5]

satyanarayanareddy
Posts: 17
Joined: Thu Jan 03, 2019 3:54 am

Re: Mutable and Immutable objects

Post by satyanarayanareddy » Mon Jan 07, 2019 10:09 am

Mutable: an object is mutable when you can change its value and it actually creates a new reference in memory of this object.

Immutable: an object is immutable when you can not change its value once it's referenced because it only creates one reference in memory the only thing you could do is redeclaring the object that will turn in losing all the values it had. Some of the classes that are immutable in java are the Wrapper classes just like Integer,Float,Double,Character,Byte

Post Reply

Return to “Java Strings”