Create immutable class by creating final class that have final data members
we have created a final class named Employee. It have one final datamember, a parameterized constructor and getter method
public final class Employee{
final String pancardNumber;
public Employee(String pancardNumber){
this.pancardNumber=pancardNumber;
}
public String getPancardNumber(){
return pancardNumber;
}
}
Liked By
Write Answer
How to create Immutable class?
Join MindStick Community
You have need login or register for voting of answers or question.
Anonymous User
27-Apr-2015