import java.io.*;
class JavaThrows{
public int compute(int x) throws ArithmeticException{
int z=100/x;
return z;}
public void method1(){
int x;
while(true){
try{
x=System.in.read();
x=x-48;
x=compute(x);
System.out.println(x);}
catch(IOException ioe){
System.out.println("read error");}
catch(ArithmeticException e){
System.out.println("devided by 0");}
}}
public static void main(String args[]){
JavaThrows t1=new JavaThrows();
t1.method1();}
}
评论