I extend a class with multiple constructors. I add a final field in my subclass which ofcourse needs to be initialized in my own constructors.
The problem is I don’t want to re-implement (most) of the constructors of the superclass, so I would like to do something like this:
public myConstructor(Object... params){
super(params);
try{
this.finalField = "backup value";
}
catch(someException e){
}
}
Is this possible in some way or the other?
edit:
I realized this scenario will never happen, because the superclass constructor will never call my own constructor.
Have all your constructors call one single constructor that sets the final field.