单选题:Suppose Exception2 is derived from Exception1. Analyze the follo
Suppose Exception2 is derived from Exception1. Analyze the following code. @[A](2)
try {
statement1;
statement2;
statement3;
}
catch (Exception1 ex1)
{
}
catch (Exception2 ex2)
{
}
A. If an exception of the Exeception2 type occurs, this exception is caught by the first catch block.
B. If an exception of the Exeception2 type occurs, this exception is caught by the second catch block.
C. The program has a compile error because these two catch blocks are in wrong order.
D. The program has a runtime error because these two catch blocks are in wrong order.
A.If an exception of the Exeception2 type occurs, this exception is caught by the first catch block.
B.If an exception of the Exeception2 type occurs, this exception is caught by the second catch block.
C.The program has a compile error because these two catch blocks are in wrong order.
D.The program has a runtime error because these two catch blocks are in wrong order.
答案:A
try {
statement1;
statement2;
statement3;
}
catch (Exception1 ex1)
{
}
catch (Exception2 ex2)
{
}
A. If an exception of the Exeception2 type occurs, this exception is caught by the first catch block.
B. If an exception of the Exeception2 type occurs, this exception is caught by the second catch block.
C. The program has a compile error because these two catch blocks are in wrong order.
D. The program has a runtime error because these two catch blocks are in wrong order.
A.If an exception of the Exeception2 type occurs, this exception is caught by the first catch block.
B.If an exception of the Exeception2 type occurs, this exception is caught by the second catch block.
C.The program has a compile error because these two catch blocks are in wrong order.
D.The program has a runtime error because these two catch blocks are in wrong order.
答案:A