Which code fragment displays the three-character month abbreviation?

Given the code fragment:

SimpleDataFormat sdf;

Which code fragment displays the three-character month abbreviation?

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



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Naresh

Naresh

Correct Answer (C)