nerdexam
Oracle

1Z0-804 · Question #93

Which two code blocks correctly initialize a Locale variable?

The correct answer is D. Locale loc4 = Locale.UK; E. Locale loc5 = new Locale("ru", "RU"). D: The Locale class provides a number of convenient constants that you can use to create Locale objects for commonly used locales. For example, the following creates a Locale object for the E: Create a Locale object using the constructors in this class: Locale(String language)…

Localization

Question

Which two code blocks correctly initialize a Locale variable?

Options

  • ALocale loc1 = "UK";
  • BLocale loc2 = Locale.getInstance("ru");
  • CLocale loc3 = Locale.getLocaleFactory("RU");
  • DLocale loc4 = Locale.UK;
  • ELocale loc5 = new Locale("ru", "RU");

How the community answered

(19 responses)
  • A
    5% (1)
  • B
    16% (3)
  • C
    5% (1)
  • D
    74% (14)

Explanation

D: The Locale class provides a number of convenient constants that you can use to create Locale objects for commonly used locales. For example, the following creates a Locale object for the E: Create a Locale object using the constructors in this class: Locale(String language) Locale(String language, String country) Locale(String language, String country, String variant)

Topics

#Locale#Locale initialization#Locale.UK#locale constants

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice