Oracle Certified Professional Java Se 11 Developer · Free Practice Question Easy
Question 14
Question ID: UKOCP23777
Following resource bundle files are defined for the project:
ResourceBundle_CA.properties
ResourceBundle_hi.properties
ResourceBundle_IN.properties
ResourceBundle.properties
All the resource bundle files have same keys.
The default locale of the system is 'fr_CA'
Which of the resource bundle will be loaded for Locale en_IN?
- A ResourceBundle_CA.properties
- B ResourceBundle_hi.properties
- C ResourceBundle_IN.properties
- D ResourceBundle.properties
Reveal correct answer
Correct answer: D
Explanation
UKOCP23777:
Default Locale is: fr_CA and passed Locale to getBundle method is: en_IN
The search order for matching resource bundle is:
1. ResourceBundle_en_IN.properties [1st: Complete en_IN].
2. ResourceBundle_en.properties [2nd: Only language en].
3. ResourceBundle_fr_CA.properties [3rd: Complete default Locale fr_CA].
4. ResourceBundle_fr.properties [4th: Language of default Locale fr].
5. ResourceBundle.properties [5th: ResourceBundle's name without language or country].
Out of the given resource bundles, 'ResourceBundle.properties' matches.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
