Wednesday, 23 November 2016

Immutable class:

 

  • Make class final so that it should not be inherited.
  • All the variables should be private so should not be accessible outside of class. 
  • Make all variables final so that value can not be changed.
  • constructor to assign values to variables in class.
  • Do not add any setter methods.

No comments:

Post a Comment