What will be printed when you execute the code?
package net.dharmaraj;
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();
}
}
A) Class A Constructor followed by Class B Constructor
B) Class B Constructor followed by Class A Constructor
C) Compile time error
D) Run time error
Answer:- a
Class A Constructor
Class B Constructor
No comments:
Post a Comment