Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.GregorianCalendar;

public class Main extends GregorianCalendar {

    public static void main(String[] args) {

        Main cal = new Main();

        // clear the calendar
        cal.clear();

        // set a new year and call computeFields()
        cal.set(GregorianCalendar.YEAR, 2013);
        cal.computeFields();

        // print the current date
        System.out.println("New date is : " + cal.getTime());

    }
}