Java OCA OCP Practice Question 2548

Question

What's the output of the following code?

Locale locale = new Locale("fr", "FR");
Locale.setDefault(locale);
Locale locale1 = Locale.FRENCH;
System.out.println(locale1.getDisplayCountry());
  • a France
  • b FR
  • c fr
  • d No output
  • e Runtime exception


d

Note

When you create a locale using only the language component, its region or country part remains unassigned.

Calling getDisplayCountry() on such a Locale object will return an empty string.




PreviousNext

Related