This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Java" Watch "Java" New topic
Author

Java

Suhail Mohammed
Greenhorn

Joined: Mar 26, 2007
Posts: 4
How to make a class immutable???
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14193
    
  20

Welcome to JavaRanch.

Do you know exactly what "immutable" means?

To make a class immutable, make sure that it does not have any non-private methods that change the internal state of instances of the clas (i.e. methods that change the values of member variables).

Also please use a meaningful subject line instead of "Java" when you ask a question.
[ March 26, 2007: Message edited by: Jesper Young ]

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
GeeCON Prague 2014
 
subject: Java