The SuperClass constructor invocation statement, super, is processed before the new instance of
Test class has been created. For that reason, the arguments to the superclass constructor invocation statement can not legally refer to members that have not been created and initialized. These include:
- Instance variables declared in this class or any superclass.
- Instance methods declared in this class or any superclass.
- The keyword this.
Legal references include:
- Static variables declared in the subclass class or any superclass.
- Static methods declared in the subclass or any superclass.
So, all we have to do is make instanceVariable static.