+ 2
What is immutable class in java?
4 Réponses
+ 3
it basically means an object can’t be changed by other code down the line
+ 1
It means object is created, we cannot change its content. In Java, because immutable class are final class also instances member are also final so we can not extend that class .
+ 1
The concept of immutatabilty, is when, after and object is created it cannot have ANY of its data (fields) be modified or “mutated”.
This is usually done by encapsulation and the removal of all setters (or anything that can manipulate and change the data within) and only expose getters which return pointers if the data.
- 1
Cc