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