Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {

    public static void main(String[] args) {

        // create a calendar
        Locale locale1 = Locale.CANADA;
        TimeZone tz1 = TimeZone.getTimeZone("GMT");
        Calendar cal1 = Calendar.getInstance(tz1, locale1);

        // display time zone for both calendars
        String tzname1 = tz1.getDisplayName();
        String name1 = locale1.getDisplayName();
        System.out.println("GMT and Canada: " + tzname1 + " " + name1);
    }
}