Given the following code:.
// (1) INSERT ONE IMPORT STATEMENT HERE public class Main { public static void main(String[] args) { System.out.println(Locale.UK); // Locale string for UK is "en_GB". } }
Which statements, when inserted at (1), will result in a program that prints en_GB, when compiled and run?.
Select the two correct answers.
(a) and (b)
(a) imports all types from the package java.util, including the type java.util.Locale. (b) explicitly imports the type java.util.Locale, which is what is needed.
(c) is syntactically incorrect, as java.util.Locale.UK is not a type. (d) imports types from the package java.util.Locale, but not the type java.util.Locale.
In (e), the static import is specified from a package (java.util), and not from a type, as required.
In (f), the static import is incorrectly specified for a type (java.util.Locale) and not for a static member.
Both (g) and (h) with static import do not work, because we are referring to the constant UK using the simple name of the class ( Locale) in the main()
method.