1Z0-804 · Question #101
Given the code fragment: DateFormat df; Which statement defines a new Dateformat object that displays the default date format for the UK Locale?
The correct answer is C. df = DateFormat.getDateInstance (DateFormat.DEFAULT, Locale.UK). The UK locale is constructed withLocale.UK. To format a date for a different Locale, specify it in the call to getDateInstance(). DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE); Note: getDateInstance( int style, Locale aLocale ) Gets the date formatter with the…
Question
Given the code fragment:
DateFormat df; Which statement defines a new Dateformat object that displays the default date format for the UK Locale?
Options
- Adf = DateFormat.getDateInstance (DateFormat.DEFAULT, Locale (UK));
- Bdf = DateFormat.getDateInstance (DateFormat.DEFAULT, UK);
- Cdf = DateFormat.getDateInstance (DateFormat.DEFAULT, Locale.UK);
- Ddf = new DateFormat.getDateInstance (DateFormat.DEFAULT, Locale.UK);
- Edf = new DateFormat.getDateInstance (DateFormat.DEFAULT, Locale (UK));
How the community answered
(26 responses)- A4% (1)
- B8% (2)
- C73% (19)
- E15% (4)
Explanation
The UK locale is constructed withLocale.UK. To format a date for a different Locale, specify it in the call to getDateInstance(). DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE); Note: getDateInstance( int style, Locale aLocale ) Gets the date formatter with the given formatting style for the given locale.
Topics
Community Discussion
No community discussion yet for this question.