Given the code fragment:
SimpleDataFormat sdf;
Which code fragment displays the three-character month abbreviation?
A.
SimpleDateFormatsdf = new SimpleDateFormat (“mm”, Locale.UK); System.out.println (“Result:” + sdf.format(new Date()));
B.
SimpleDateFormatsdf = new SimpleDateFormat (“MM”, Locale.UK); System.out.println (“Result:” + sdf.format(new Date()));
C.
SimpleDateFormatsdf = new SimpleDateFormat (“MMM”, Locale.UK); System.out.println (“Result:” + sdf.format(new Date()));
D.
SimpleDateFormatsdf = new SimpleDateFormat (“MMMM”, Locale.UK); System.out.println (“Result:” + sdf.format(new Date()));
Explanation:
Output example: JUN
Correct Answer (C)