About Question enthuware.ocpjp.v21.2.4019 :
Posted: Mon May 26, 2025 12:31 am
msgs.properties is searched for only default Locale?
Java Certification Resources and Java Discussion Forum
https://enthuware.com/forum/
If the above is not clear, please read the relevant sections of the book posted above. If that is not clear, please go through the JavaDoc of getBundle: https://docs.oracle.com/en/java/javase/ ... assLoader)When you look for a resource bundle for Locale.of("fr"), the localization framework will look for msgs_fr.properties file. However, in the given situation, msgs_fr.properties is not present. Although msgs_fr_FR.properties is present, it will not be used because fr_FR is not a parent of fr. fr is a parent of fr_FR.
Since the localization framework is not able to create a resource bundle for msgs_fr, it will look for a resource bundle for the default locale, which is en_GB. To create a resource bundle for en_GB, it will look for msgs_en_GB.properties, msgs_en.properties, and msgs.properties, in that order. It will not find msgs_en_GB.properties, but the other two are present. Thus, the entry accountinfo={0}''s balance is {1} from msgs_en.properties will be used.