Menu
Topics Index
...
`

Print Time Zone


If you need explanation Read this topic

If you need Answer Take test on this topic

Print Time Zone
What will be the output of the following program?
import java.util.*;
public class TimeZ {
    public static void main(String[] args) {
        Calendar now = Calendar.getInstance();
        TimeZone timeZone = TimeZone.getTimeZone("IST");
        System.out.println(timeZone.getDisplayName());
        timeZone = TimeZone.getTimeZone("GMT");
        now.setTimeZone(timeZone);
        System.out.println(timeZone.getDisplayName());
    }
}

A. India Standard Time
India Standard Time
B. Greenwich Mean Time
Greenwich Mean Time
C. India Standard Time
Greenwich Mean Time
D. Greenwich Mean Time
India Standard Time
E. Compilation Error or Runtime Error
Topic: Java TimeZone Class

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.

Ans is C since the utility package consists of all system utilities about date and time it displays name of IST and GMT

Posted by Naga Sinst    2014-03-13 12:56:39


answer is c

Posted by Saikiran Vavilala    2014-03-13 13:03:10


answer is c , first time it prints "IST", and second tym it prints "GMT"....

Posted by Saikiran Vavilala    2014-03-13 13:04:43


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

Posted by Merit Campus    2014-03-14 04:06:11


© meritcampus 2019

All Rights Reserved.

Open In App