I have got an interview question where interviewer asked me, "How will you create an immutable class in java, which class will have more than 100 fields in it?"
As we know to create immutable class we need to declare a class as final, need to declare all the fields as final and there should not be any setter method present in that class. We need to initialize those field in the constructor.
But what will happen when we have more than 10 fields or more fields? We can not pass all the fields in the constructor right? In this scenario, how can we create an immutable class?