This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make a Immutable Object?

 
RaviNada Kiran
Ranch Hand
Posts: 528
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String is a immutable Object?
similarly Can we make an immutable Object in java ?

I have read that we can make a immutable Object without providing any setter methods ?? Is this true ?

If there are no setter methods on to our Object then how can we set data initially? Is this possible if i make the setter methods as final??
 
Amit Ghorpade
Bartender
Posts: 2854
10
Fedora Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question has been discussed many times before, try searching this forum. I have found this and this for you .
 
Harshit Rastogi
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
another useful link i found earlier:How to create Immutable class
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic