• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java

 
Suhail Mohammed
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to make a class immutable???
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic