6.7.18.If you extend a class without no-argument constructor, then you must explicitly call super().
public class MainClass { public static void main(String[] argv) { new MySubclass();
}
}
class MyClass { public MyClass(int i) {
System.out.println("MyClass");
}
}
class MySubclass { public MySubclass() { super(0);
System.out.println("MySubclass");
}
}
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The constructor Object(int) is undefined
at MySubclass.(MainClass.java:15)
at MainClass.main(MainClass.java:3)