Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Calendar;
import java.util.TimeZone;

public class Main {

    public static void main(String[] args) {

        TimeZone tz1 = TimeZone.getTimeZone("GMT");
        Calendar cal1 = Calendar.getInstance(tz1);

        // display time zone for both calendars
        System.out.println("GMT: " + cal1.getTimeZone().getDisplayName());
    }
}