Immutable class and immutable objects in java

The concept of immutability in java says's that class needs to be marked final to make it immutable.

My question is if we do not mark a class as final then it can be subclassed but still it will be the object of sub-class that will be mutable and not the base class. The state/properties of base class will remain immutable as we will mark properties of the base class as private.

Second question is are immutable class and immutable objects are two different concepts in java?...

Read More »

By: StackOverFlow - Saturday, 10 March

Related Posts