public class ExceptionTest {
public static void main(String[] args) {
int i = 0;
try {
if(i == 0) {
throw new IOException();
}
} catch (IOException e) {
System.out.println("right!");
}
}
}
运行正常, 输出正确结果: right!。
public class ExceptionTest {
public static void main(String[] args) {
int i = 0;
try {
if(i == 0) {
throw new IOException();
}
} catch (IOException e) {
System.out.println("right!");
}
}
}
运行正常, 输出正确结果: right!。