package net.dharmaraj;
import java.io.*;
class A
{
A()
{
System.out.println("Executing class A1 constructor");
}
A(int a) throws Exception
{
System.out.println("Executing class A2 constructor");
throw new IOException("Dunu");
}
}
public class B extends A
{
B()
{
System.out.println("Executing class B constructor");
}
public static void main(String args[])
{
try
{
A a = new B();
// A a1=new A(2);
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}
A) Executing class A1 constructor followed by Executing class B constructor
B) No output
C) Runtime error
D) Compile time error
Compile Out pur :--
Executing class A1 constructor
Executing class B constructor
No comments:
Post a Comment