Can you create immutable object in Java?

Yeah, it's pretty simple.
A small line of code can do the magic :) :)

Static final int i = 100;
Now int i is immutable.

Note: An object is immutable means , the value of the object can not be destroyed.

Happy Learning !!


No comments :

Post a Comment