public class sub1
{
public static void main(String[] args)
{
try
{
// throw new Exception();
// throw new ExceptionA();
// throw new ExceptionB();
throw new ExceptionC();
}
catch(Exception e)
{
System.out.println("Caught Exception");
e.printStackTrace(System.out);
}
}
}
class ExceptionA extends Exception
{
public ExceptionA(){
super();
}
public ExceptionA(String msg){
super(msg);
}
}
class ExceptionB extends ExceptionA
{
public ExceptionB(){
super();
}
public ExceptionB(String msg){
super(msg);
}
}
class ExceptionC extends ExceptionB
{
public ExceptionC(){
super();
}
public ExceptionC(String msg){
super(msg);
}
}