Java Date Time - Month JUNE example








Month JUNE defines the singleton instance for the month of June with 30 days.

This has the numeric value of 6.

Syntax

JUNE has the following syntax.

public static final Month JUNE

Example

The following example shows how to use JUNE.

import java.time.Month;
//from  w w  w .  j  a v  a  2  s  . co  m
public class Main {
  public static void main(String[] args) {
    Month m = Month.JUNE;
    System.out.println(m.getValue());
    System.out.println(m.name());
    System.out.println(m.ordinal());
  }
}

The code above generates the following result.