
What is mean by immutable object/class?
Assume we have a below class A as mutable:
Class A{
int i = 10;
int j = 20;
A a = new A();
}
a.i = 30;
a.j = 40;
Changing state of objects, so A is mutable.
Immutable: once object is created, we cannot change the content of the object.
String str = "Venu" -> We ca not change the state of str because string is immutable
str.concate("gopal)...