Menu
Topics Index
...
`

Indian Independence Day


If you need explanation Read this topic

If you need Answer Take test on this topic

Indian Independence Day
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(2014, 08, 15, 21, 69, 55);
        p(gc, Calendar.YEAR);
        p(gc, Calendar.MONTH);
        p(gc, Calendar.DATE);
        p(gc, Calendar.DAY_OF_WEEK);
        p(gc, Calendar.DAY_OF_WEEK_IN_MONTH);
        p(gc, Calendar.DAY_OF_YEAR);
        p(gc, Calendar.HOUR);
        p(gc, Calendar.HOUR_OF_DAY);
        p(gc, Calendar.MINUTE);
        p(gc, Calendar.SECOND);
    }
    static void p(Calendar c, int type) {
        System.out.print(c.get(type) + "-");
    }
}

A. 2014-8-15-1-3-3-10-22-9-55-
B. 2014-8-15-1-3-258-10-22-9-55-
C. 2014-8-15-1-3-258-10-21-69-55-
D. Compilation Error
E. Runtime Error
Topic: Java GregorianCalendar

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Answer is b. 21-69-55 will be converted to 22-09-55

Posted by Shashanka Mogaliraju    2014-08-15 04:47:04


d.compilation error.incorect syntax for function of calendar clas Date_OF_WEEK

Posted by Bilal Ahmad    2014-08-15 05:13:12


ans IS D Comiplation error for no 08
Error:integer number too large: 08

Posted by Mânïshå Mùlchåndânï    2014-08-15 08:55:34


Congratulations Mânïshå Mùlchåndânï. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-08-18 05:13:15


© meritcampus 2019

All Rights Reserved.

Open In App