Java SE 11 Developer — Question 32
Which two statements set the default locale used for formatting numbers, currency, and percentages? (Choose two.)
Answer options
- A. Locale.setDefault(Locale.Category.FORMAT, “zh-CN”);
- B. Locale.setDefault(Locale.Category.FORMAT, Locale.CANADA_FRENCH);
- C. Locale.setDefault(Locale.SIMPLIFIED_CHINESE);
- D. Locale.setDefault(“en_CA”);
- E. Locale.setDefault(“es”, Locale.US);
Correct answer: B, D
Explanation
Option B is correct because it sets the default locale for formatting specifically to Canadian French, which is appropriate for currency and number formatting. Option D is also correct as it sets the locale to Canadian English, which aligns with the requirements for formatting. Options A, C, and E do not set the locale in a manner that is applicable for formatting numbers, currency, or percentages in the required way.