Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to create immutable classes

 
manish basotia
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please reply fast
 
Erik Pragt
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Very easy
 
Scotty Sinclair
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Just to clarify, A class is immutable a long as no method calls will change the state of the class. So the above example is fine.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the javaRanch Journal: Mutable and Immutable Objects
Dave.
 
John O'Hanley
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is some good info on immutable object:
http://www.javapractices.com/Topic29.cjp
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic