Menu
Question Index
...

What will be the output of the following program?

import java.util.*;
public class IndependenceDay {
    public static void main(String[] args) {
        GregorianCalendar gc = new GregorianCalendar(2015, 8, 15, 25, 00, 00);
        p(gc, Calendar.YEAR);
        p(gc, Calendar.MONTH);
        p(gc, Calendar.DATE);
        p(gc, Calendar.HOUR);
        p(gc, Calendar.MINUTE);
        p(gc, Calendar.SECOND);
    }
    static void p(Calendar c, int type) {
        System.out.print(c.get(type) + "-");
    }
}


2015-8-16-1-0-0-
2013-8-15-1-0-0-
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java GregorianCalendar

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App