package java_learning;
//Demonstrate throw.
public class ThrowDemo {
static void demoproc() {
try {
throw new ArithmeticException ("demo");//创建Java的标准异常对象
} catch(ArithmeticException e) {
System.out.println("Caught1 inside demoproc.");
throw e; // rethrow the exception
}
}
public static void main(String args[]) {
try {
try{
demoproc();
}catch(ArithmeticException e) {
System.out.println("Recaught2: " + e);
}
} catch(ArithmeticException e) {
System.out.println("Recaught3: " + e);
}
}
}
/**/
ThrowDemo
最新推荐文章于 2022-08-12 21:50:47 发布