Why final keyword is necessary for immutable class?
Could you please clarify that why final keyword is required before class when we are making it an immutable one. I mean, if we declare all of it's attributes as private and final, then also it is an immutable class, isn't it? Sorry if the question seems easy, but i am truly confused about it. Help me out. Editted: I know that a class declared final can't be subclassed.. But if each attribute is private and final then what difference does that make? Jon Skeet As stacker says, final makes sure the class isn't subclassed. That's important so that any code which is relying on its immutability can