New course! Every coder should learn Generative AI!
Try a free lesson0
yes, it is inherited automatically
you can override it (but it runs both A and B constructor)
or overload too
class A {
A() {
System.out.println("constructor A");
}
}
class B extends A {}
class Constructor_Test {
public static void main(String[] args){
B b = new B();
}
}
// output: constructor A