Java OCA OCP Practice Question 3049

Question

Which one of the following statements will compile without errors?

  • a) Locale locale1 = new Locale.US;
  • b) Locale locale2 = Locale.US;
  • c) Locale locale3 = new US.Locale();
  • d) Locale locale4 = Locale("US");
  • e) Locale locale5 = new Locale(Locale.US);


b)

Note

the static public final Locale US member in the Locale class is accessed using the expression Locale.US, as in option b).

the other options will result in compiler error(s).




PreviousNext

Related