Which two assignments create Locale instances? (Choose two.)
Which two assignments create Locale instances? (Choose two.)
The creation of Locale instances in Java can be done using the Locale constructor or by calling specific methods that return a Locale instance. Option C uses the constructor `new Locale(“en”, “GB”)` which directly creates a new Locale instance representing English in Great Britain. Option E uses the method `Locale.getDefault()`, which returns the default Locale instance for the current Java Virtual Machine. Options A and B do not correctly instantiate Locale objects as they simply assign strings. Option D calls a method that returns an array of Locale instances, not a single Locale instance.
Tested: CE.
Option C creates a new Locale instance using the Locale constructor that takes two arguments: a language code and a country code. In this case, the language code is "en" for English and the country code is "GB" for Great Britain.Option E creates a Locale instance by calling the static method Locale.getDefault(), which returns the default Locale for the current instance of the Java Virtual Machine.
Tested CE D return [] of Locale
answer : C Actually D. locale = Locale.getAvailableLocales() E. locale = Locale.getDefault(); They are both not created new instances They just return already existed one.
D. locale = Locale.getAvailableLocales() It could be Locale[] locale = Locale.getAvailableLocales()