Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import static java.util.Calendar.DAY_OF_MONTH;
import static java.util.Calendar.MARCH;
import static java.util.Calendar.MONTH;
import static java.util.Calendar.YEAR;

import java.util.Calendar;
import java.util.GregorianCalendar;

public class Main {

    public static void main(String... args) {
        Calendar calendar = GregorianCalendar.getInstance();
        calendar.set(YEAR, 2015);
        calendar.set(MONTH, MARCH);
        calendar.set(DAY_OF_MONTH, 1);
        System.out.println(calendar.getTime());
        calendar.add(DAY_OF_MONTH, -1);
        System.out.println(calendar.getTime());

    }
}