Given the content:
and given the code fragment:Which two code fragments, when inserted at line 1 independently, enable the code to print "Wie geht's?"
Given the content:
and given the code fragment:Which two code fragments, when inserted at line 1 independently, enable the code to print "Wie geht's?"
Answer is AB.
AB tested Locale currentLocale = new Locale ("de", "DE"); System.out.println(currentLocale); currentLocale = new Locale.Builder ().setLanguage ("de").setRegion ("DE").build(); System.out.println(currentLocale); currentLocale = Locale.GERMAN; System.out.println(currentLocale); output: de_DE de_DE de
Ansewer is A and B. new Locale(); is not valid
Answer is AB. Locale.GERMAN returns Locale("de") only. You need Locale.GERMANY to have Local("de", "DE")
Locale.GERMANY is new Locale("de", "DE")
Locale.GERMAN is new Locale("de")
A and B are correct. C gives de only, D doesn't compile since Locale doesn't have no-arg constructor and setters (that's Locale.Builder) and E doesn't compile since there is no getInstance method defined on Locale.
Answer is AB