class ExException5{
public static void main (String[] args) {
try { //(1)try節
int x = Integer.parseInt(args[0]);
System.out.println("答えは" + (100/x));
} catch(ArithmeticException e) { //(2)catch節
System.err.println("エラー" + e.getMessage());
} finally { //(3)finally節
System.out.println("This program was finished.");
}
}
}
|