Given:



What is the result?

A.

Caught java.lang.RuntimeException: Exception
Exception in thread "main" java.lang.Error: Error
at TestApp.doList(TestApp.java: 14)
at TestApp.main(TestApp.java: 6)

B.

Exception in thread "main" java.lang.Error: Error
at TestApp.doList(TestApp.java: 14)
at TestApp.main(TestApp.java: 6)

C.

Caught java.lang.RuntimeException: Exception
Caught java.lang.Error: Error

D.

Caught java.lang.RuntimeException: Exception

題解

程式第5行會呼叫第14行的doPrint方法,然後拋出一個RuntimeException物件。這個RuntimeException會在程式第7行的catch被接住,然後輸出「Caught java.lang.RuntimeException: Exception」。