class Excep extends Exception
{
public int a;
public Excep(int i)
{
a=i;
}
public void ToString()
{
if(a<10)
System.out.println("抛出A类异常");
else
System.out.println("抛B鯝类异常");
}
}
class demo
{ public int a;
demo(int i)
{
a=i;
}
public void f()throws Excep
{
if(a>0)
{
throw new Excep(a);
}
}
}
class main
{ public static void main(String []arg)
{
demo d;
try{
d=new demo(100);
d.f();
}
catch(Excep e)
{
e.ToString();
}
}
}