Discussion in 'Strings, I/O, Formatting, Parsing' started by Harikrishna123, Mar 19, 2010.
Is this possible to create a our own immutable class? If yes how can we do that?
yes we can make a class a immutable
public class final ClassName
--- all properties must be final and private
private final int i =10;
--- all behaviours must be final
1. Announce the class Concerning illustration last thus it can't be stretched out.
2. Make know fields private thereabouts that regulate right is not permitted.
3. Don't give setter techniques to variables.
4. Aggravate all alterable fields last thereabouts that its esteem could make doled out main once.
Separate names with a comma.