This video will describe you how to design immutable class in java using getters and final keyword use.
Interview question and useful in software development. You should follow the below steps:
1. Make your class final, so that no other classes can extend it.
2. Make all your fields final, so that they’re initialized only once inside the constructor and never modified afterward.
3. Don’t expose setter methods.
4. When exposing methods which modify the state of the class, you must…