Menu
Question Index
...

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");
        timeZone = TimeZone.getTimeZone("GMT");
        System.out.println(timeZone.getDisplayName());
        now.setTimeZone(timeZone);
        System.out.println(timeZone.getDisplayName());
    }
}


India Standard Time
India Standard Time
Greenwich Mean Time
Greenwich Mean Time
India Standard Time
Greenwich Mean Time
Greenwich Mean Time
India Standard Time
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java TimeZone Class

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App