I\'d like to do the following:
public class Sub extends Super {
public Sub(Super underlying) {
if (underlying == null) {
underlying = super; // this
You have not understood the super
keyword in java correctly. Refer the javadoc for super
If your method overrides one of its superclass's methods, you can invoke the overridden method through the use of the keyword super. You can also use super to refer to a hidden field (although hiding fields is discouraged)
Also, super()
is used to call the parent class constructors.