• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java  RSS feed

 
Suhail Mohammed
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to make a class immutable???
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15865
81
Android IntelliJ IDE Java Scala Spring
  • 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 ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!