Java |异常处理|问题2

null

class Test extends Exception { }
class Main {
public static void main(String args[]) {
try {
throw new Test();
}
catch (Test t) {
System.out.println( "Got the Test Exception" );
}
finally {
System.out.println( "Inside finally block " );
}
}
}


(A)

Got the Test Exception
Inside finally block 

(B)

Got the Test Exception

(C)

Inside finally block 

(D) 编译错误 答复: (A) 说明: 在Java中,finally总是在try-catch块之后执行。此块可用于执行常见的清理工作。C++中没有这样的块。 这个问题的小测验

© 版权声明
THE END
喜欢就支持一下吧
点赞7 分享