源代码如下
package ch1;
//import java.io.*;
public class TestEx{
public void m(int i_int) throws ArithmeticException{
if(i_int==0)
throw new ArithmeticException("被除数为零");
}
public static void main(String[] args){
/*
try{
System.out.println(2/0);
}catch(ArithmeticException ae){
System.out.println("error!");
ae.printStackTrace();
}
*/
TestEx me=new TestEx();
me.m(0);
}