nerdexam
Oracle

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…

Localization

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)
  • A
    4% (1)
  • B
    8% (2)
  • C
    73% (19)
  • E
    15% (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

#DateFormat#getDateInstance#Locale.UK#date formatting

Community Discussion

No community discussion yet for this question.

Full 1Z0-804 Practice