Menu
Question Index
...

What will be output of the following program?

import java.util.*;
public class FormattingDateAndTime {
    public static void main(String[] args) {
        Calendar cal = Calendar.getInstance();
        Formatter fmt = new Formatter();
        cal.set(2014, 8, 18);
        fmt.format("%tF", cal);
        System.out.println(fmt);
    }
}


2014-08-18
2014-09-18
2014-Aug-18
2014-Sep-18
Compilation Error or Runtime Error

Doubts

Problems

Topic: Formatting Date And Time In Java With Example

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App