class myException extends Exception
{
myException(String mes)
{
super(mes);
}
}
class exctest
{
public void getDiv(int a,int b) throws myException
{
if(b==0)
throw(new myException("by zero"));
System.out.println(a/b);
}
}
class mainpro
{
public static void main(String[] arg)
{
exctest div=new exctest();
try{
div.getDiv(5,0);
}
catch(myException e)
{
System.out.println(e.toString());
}
// catch(myException e)
// {
// System.out.println("zidingyi");
// }
}
}
throw try catch的实现原理是什么啊?throw执行后是不是会调用catch函数?java中有没有反汇编器,可以看看throw try catch的实现原理? |