Class A{
int aVar;
public A(int a){aVar=a;}
}
class B extends A{
int bVar;
public B(int b){
// super(10);
bVar=b;
}
public static void main(
String[] args){
B b=new B(2);
}
}
In the above case, there 's a compilation error stating that the contructor A() is not present. But when I uncomment the line super(10).. the program compiles..
Please explain how this is a compilation error but not a runtime error. I presume that when a class extends another class, a super() call is made to the no arg constructor
unless another parameterized constructor of the super class is explicitly called. But I think this is known only during execution time