+ 2

What is immutable class in java?

21st Aug 2019, 8:33 AM
Piyush Srivastava
Piyush Srivastava - avatar
4 Antworten
+ 3
it basically means an object can’t be changed by other code down the line
21st Aug 2019, 8:41 AM
Brave Tea
Brave Tea - avatar
+ 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 .
22nd Aug 2019, 7:37 PM
[No Name]
[No Name] - avatar
+ 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.
23rd Aug 2019, 9:32 PM
Andy Wong
Andy Wong - avatar
- 1
Cc
22nd Aug 2019, 6:15 PM
Mostafa El Lmodne
Mostafa El Lmodne - avatar