Menu
Topics Index
...
`

Indian Independence Day2152


If you need explanation Read this topic

If you need Answer Take test on this topic

Indian Independence Day2152
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(2013, 8, 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. 2013-8-15-1-3-3-10-22-9-55-
B. 2013-8-15-1-3-258-10-22-9-55-
C. 2013-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.

B is ans.as year n all othres gives same value.
but HOUR_OF_DAY is 22
we are using here Gregorian calender.

Posted by Shabaaz Shaikz    2014-05-22 09:47:57


ans D as the calender variable is  unable to find in the function call p

Posted by Manasa Jyothi Sree    2014-05-23 07:37:45


Congratulations Shabaaz Shaikz. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-05-23 07:43:30


© meritcampus 2019

All Rights Reserved.

Open In App