Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Immutable class

 
leela krishhna
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to create simple User defined Immutable class...
 
R. Jain
Ranch Hand
Posts: 375
1
Java Python Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to post some code here, to show what efforts you have already made..
Whatever code you have implemented to get the outcome.. Or at least the idea you have.

You can get better inputs from other users.
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's a simple example:



 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, I didn't post that example for a joke. It is indeed an immutable class, and it's the simplest possible example.

So now here's an exercise for you: Explain why it is immutable. (Hint: what does "immutable" mean? And does this class satisfy that definition?)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic