Given the content of /resourses/Message.properties:



welcome1="Good day!"

and given the code fragment:

What is the result?

A.

Good day!
Test

followed by an Exception stack trace
B.

Good day!

followed by an Exception stack trace
C.

Good day!
Test
null

D. A compilation error occurs at line n1.

題解

程式第13行,會輸出「/resourses/Message.properties」中「welcome1」鍵值所對應的值,即為「Good day!」。

程式第14行,由於「/resourses/Message.properties」中不存在「welcome2」鍵值,但有設定預設值「Test」,所以會輸出預設值「Test」。

程式第15行,由於「/resourses/Message.properties」中不存在「welcome3」鍵值,所以輸出「null」。