use super()from C and from B to access the constructor
class A {
public A() {
System.out.println("A");
}
}
class B extends A {
public B() {
super();
System.out.println("B");
}
}
class C extends B {
public C() {
super();
System.out.println("C");
}
}
public class Inheritance {
public static void main(String[] args) {
C c = new C();
}
}
Output:
a
B
C
Note:
If everyone is the default constructor, then there is no need to write super();, it will implicitly call it.
, super(parameter.. )