Menu
Question Index
...

What will be the output of the following program?

import java.util.*;
public class CalendarDemo {
    public static void main(String[] args) {
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.HOUR, 23);
        cal.set(Calendar.MINUTE, 58);
        cal.set(Calendar.SECOND, 59);
        System.out.print(cal.get(Calendar.HOUR) + ":");
        System.out.print(cal.get(Calendar.MINUTE) + ":");
        System.out.print(cal.get(Calendar.SECOND));
    }
}


23:58:59
11:58:59
Output can not determined
Compilation Error or Runtime Error

Doubts

Problems

Topic: Calendar In Java - java.util.Calendar Class

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App