public class Main {
public static void main(String[] args) {
int x = 10, y = 0, z;/** from N o w J a v a . c o m**/
try {
System.out.println("Before dividing x by y.");
z = x / y;
System.out.println("After dividing x by y.");
}
catch (ArithmeticException e) {
System.out.println("Inside catch block - 1.");
}
finally {
System.out.println("Inside finally block - 1.");
}
try {
System.out.println("Before setting z to 2449.");
z = 2449;
System.out.println("After setting z to 2449.");
}/**来 自 N o w J a v a . c o m**/
catch (Exception e) {
System.out.println("Inside catch block - 2.");
}
finally {
System.out.println("Inside finally block - 2.");
}
try {
System.out.println("Inside try block - 3.");
}
finally {
System.out.println("Inside finally block - 3.");
}
try {
System.out.println("Before executing System.exit().");
System.exit(0);
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。