Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Calendar;

public class Main {
    public static void main(String[] args) {
        Calendar now = Calendar.getInstance();
        System.out.println(now.getTime());
        int month = now.get(Calendar.MONTH);
        if (month == Calendar.JANUARY) {
            System.out.println("JANUARY");
        }
        if (month == Calendar.FEBRUARY) {
            System.out.println("FEBRUARY");
        }
        if (month == Calendar.MARCH) {
            System.out.println("MARCH");
        }
        if (month == Calendar.APRIL) {
            System.out.println("APRIL");
        }
        if (month == Calendar.MAY) {
            System.out.println("MAY");
        }
        if (month == Calendar.JUNE) {
            System.out.println("JUNE");
        }
        if (month == Calendar.JULY) {
            System.out.println("JULY");
        }
        if (month == Calendar.AUGUST) {
            System.out.println("AUGUST");
        }
        if (month == Calendar.SEPTEMBER) {
            System.out.println("SEPTEMBER");
        }
        if (month == Calendar.OCTOBER) {
            System.out.println("OCTOBER");
        }
        if (month == Calendar.NOVEMBER) {
            System.out.println("NOVEMBER");
        }
        if (month == Calendar.DECEMBER) {
            System.out.println("DECEMBER");
        }

    }
}