> 其他 >
下面这段程序看不懂 谁能大概解释下的
import java.io.*;
class J_Exception extends Exception {
} public class J_Test {
public static void main(String[] args)
{ try { int i = System.in.read(); if(i == '0')
throw new J_Exception(); //手动抛出异常
System.out.print("1");
}catch(IOException ex) {
System.out.print("2");
}catch(J_Exception ex) {
System.out.print("3");
}finally
{ System.out.println("4");
}
}
}
为什么当输入0时得到34
人气:385 ℃ 时间:2020-04-16 20:19:23
解答
你这不是写的很清楚了么.class J_Exception extends Exception {}public class J_Test {public static void main(String[] args) {try {int ...额 刚学的这个 不懂呵呵这回懂了不?
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版