Originally posted by Valentin Crettaz:
yes it is, but they are hidden instead
Originally posted by sonir shah:
I came across a question in the mock
It is as under :
class A {
A() {
System.out.println("Class A Constructor");
}
}
public class B extends A {
B() {
System.out.println("Class B Constructor");
}
public static void main(String args[]) {
B b = new B();
}
}
// the output here is "Class A Constructor followed by Class B Constructor //
again similar question i came across.It is as under :
class A {
A(double d) {
System.out.println("Printing the value of d is 10");
}
}
public class B extends A {
B() {
System.out.println("Class B Constructor");
}
public static void main(String args[]) {
B b = new B();
}
}
[a] Printing the value of d is 10 followed by Class B Constructor
[b] Printing the value of d is 10
[c] Compile time error
[d] Run time error
//The output here is Complile Time Error..
Can any one explain me the diffrence between the two??