Given the code fragment:
dataFormat df;
Which statement defines a new DataFormat object that displays the default date format for the UK Locale?
A.
df = DateFormat.getDateInstance (DateFormat.DEFAULT, Locale(UK));
B.
df = DateFormat.getDateInstance (DateFormat.DEFAULT, UK);
C.
df = DateFormat.getDateInstance (DateFormat.DEFAULT, Locale.UK);
D.
df = new DateFormat.getDataInstance (DataFormat.DEFAULT, Locale.UK);
E.
df = new DateFormat.getDateInstance (DateFormat.DEFAULT, Locale(UK));
Explanation:
DateFormat is an abstract class that provides the ability to format and parse dates
and times. The getDateInstance() method returns an instance of DateFormat that can format date
information. It is available in these forms:
static final DateFormat getDateInstance( )
static final DateFormat getDateInstance(int style)
static final DateFormat getDateInstance(int style, Locale locale)
The argument style is one of the following values: DEFAULT, SHORT, MEDIUM, LONG, or FULL.
These are int constants defined by DateFormat.