nerdexam
Oracle

1Z0-804 · Question #112

Given a language code of fr and a country code of FR, which file name represents a resource bundle file namethat is not the default?

The correct answer is A. MessageBundle_fr_FR.properties. The default file is MessageBundle.properties. The non-default file name is MessageBundle_fr_FR.properties Note 0:.properties is a file extension for files mainly used in Java related technologies to store the configurableparameters of an application. They can also be used for…

Localization

Question

Given a language code of fr and a country code of FR, which file name represents a resource bundle file namethat is not the default?

Options

  • AMessageBundle_fr_FR.properties
  • BMessageBundle_fr_FR.profile
  • CMessageBundle_fr_FR.xinl
  • DMessageBundle__fr__FR.Java
  • EMessageBundle__fr__FR.Locale

How the community answered

(50 responses)
  • A
    72% (36)
  • B
    8% (4)
  • C
    14% (7)
  • D
    2% (1)
  • E
    4% (2)

Explanation

The default file is MessageBundle.properties. The non-default file name is MessageBundle_fr_FR.properties Note 0:.properties is a file extension for files mainly used in Java related technologies to store the configurableparameters of an application. They can also be used for storing strings for Internationalization and localization;these are known as Property Resource Bundles. Each parameter is stored as a pair of strings, one storing thename of the parameter (called the key), and the other storing the value. Note 1: You can obtain an instance of ResourceBundle by calling its static getBundle method.public static ResourceBundle getBundle(java.lang.String baseName) public static ResourceBundle getBundle(java.lang.String baseName, Locale locale) For example: ResourceBundle rb = ResourceBundle.getBundle("MyResources", Locale.US); This will load theResourceBundle object with the values in the corresponding properties file. 1.If a suitable properties file is not found, the ResourceBundle object will use the default properties file, whichwill be the one whose name equals the base name and has the properties In this case, the defaultfile would be MyResources.properties. 2.If this file is not found, a java.util.MissingResourceException will bethrown. Note2: java.util.ResourceBundle class enables you to choose and read the properties file specific to the user'slocale and look up the values. A ResourceBundle object has a base name. In order for a ResourceBundle object to pick up a properties file,the filename must be composed of the ResourceBundle base name, followed by an underscore, followed bythe language code, and optionally followed by another underscore and the country code. The format for the properties file name is as follows: basename_languageCode_countryCode For example, suppose the base name is MyResources and you define the following three locales: Then you would have these three properties files: MyResources_en_US.properties MyResources_de_DE.properties MyResources_zh_CN.properties

Topics

#resource bundle#locale#file naming#properties files

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice