1z0-829 Exam QuestionsBrowse all questions from this exam

1z0-829 Exam - Question 44


Given:

Captions.properties file:

user = UserName

Captions_en.properties file:

user = User name (EN)

Captions_US.properties file:

message = User name (US)

Captions_en_US.properties file:

message = User name (EN - US)

and the code fragment:

What is the result?

Show Answer
Correct Answer: D

The program sets the default locale to Locale.US. Then it explicitly sets the current locale to a new Locale with the language set to 'en'. When ResourceBundle attempts to find the appropriate properties file, it will look for the most specific match first and go broader if it doesn't find more specific ones. Since 'user' is specified in Captions_en.properties as 'User name (EN)', and it matches the selected locale, the result will be 'User name (EN)'.

Discussion

1 comment
Sign in to comment
SampsOption: D
Apr 25, 2024

D is correct