Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.*;

public class Main {

    public static void main(String[] args) {

        GregorianCalendar cal1 = (GregorianCalendar) GregorianCalendar.getInstance();

        // create a second calendar
        GregorianCalendar cal2 = new GregorianCalendar();

        // clone cal1 to cal2
        cal2 = (GregorianCalendar) cal1.clone();

        // print cal2
        System.out.println(cal2.getTime());

    }
}