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 cal = Calendar.getInstance();

        // get the maximum value that year field can have
        int i = cal.getActualMaximum(Calendar.YEAR);
        System.out.println("Maximum year:" + i);

        // get the maximum value that month field can have
        int a = cal.getActualMaximum(Calendar.MONTH);
        System.out.println("Maximum month:" + a);
    }
}