class Test
{
public int devide(int x,int y) throws ArithmeticException,DevideByMinusException
{
if(y<0)
throw new DevideByMinusException("devide is "+y);
int result=x/y;
return result;
}
}
class DevideByMinusException extends Exception
{
public void DevidebyMinusException (String msg)
{
super(msg);
}
}
class TestException
{
public static void main(String args [])
{
try
{
System.out.println(new Test().devide(3,1));
}
catch(DevideByMinusException e)
{
System.out.println("program is running into DevideByMinus");
e.printStackTrace();
}
catch(ArithmeticException e)
{
System.out.println("program is running into Arithmetic");
e.printStackTrace();
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
System.out.println("program is running here!");
}
}
我按书上打的怎么也运行不了为什么啊