Given:



and the code fragment:

What is the result?

A.

User is registered.

B. An AgeOutOfLimitException is thrown.
C. A UserException is thrown.
D. A compilation error occurs in the main method.

題解

由於第23行呼叫App物件的doRegister方法所傳入的age參數為60,因此第14行的if條件式會成立,所以在執行第15行時拋出AgeOutOfLimitException。