单选题:程序异常
程序异常
```
public class Test {
public static void main(String[] args) {
try {
String s = "5.6";
Integer.parseInt(s); // 引起一个 NumberFormatException异常
int i = 0;
int y = 2 / i;
}
catch (Exception ex) {
System.out.println("NumberFormatException");
}
catch (RuntimeException ex) {
System.out.println("RuntimeException");
}
}
}
```
该程序会出现( ) @[D](2)
A. 程序显示NumberFormatException。
B. 程序显示RuntimeException。
C. 程序显示NumberFormatExceptio,然后是RuntimeException。
D. 程序编译错误。
A.程序显示NumberFormatException。
B.程序显示RuntimeException。
C.程序显示NumberFormatExceptio,然后是RuntimeException。
D.程序编译错误。
答案:D
```
public class Test {
public static void main(String[] args) {
try {
String s = "5.6";
Integer.parseInt(s); // 引起一个 NumberFormatException异常
int i = 0;
int y = 2 / i;
}
catch (Exception ex) {
System.out.println("NumberFormatException");
}
catch (RuntimeException ex) {
System.out.println("RuntimeException");
}
}
}
```
该程序会出现( ) @[D](2)
A. 程序显示NumberFormatException。
B. 程序显示RuntimeException。
C. 程序显示NumberFormatExceptio,然后是RuntimeException。
D. 程序编译错误。
A.程序显示NumberFormatException。
B.程序显示RuntimeException。
C.程序显示NumberFormatExceptio,然后是RuntimeException。
D.程序编译错误。
答案:D