Java Date Time - Month OCTOBER example








Month OCTOBER defines the singleton instance for the month of October with 31 days.

This has the numeric value of 10.

Syntax

OCTOBER has the following syntax.

public static final Month OCTOBER

Example

The following example shows how to use OCTOBER.

import java.time.Month;
/* w  w w  .  j  a  va2s.  c  om*/
public class Main {
  public static void main(String[] args) {
    Month m = Month.OCTOBER;
    System.out.println(m.getValue());
    System.out.println(m.name());
    System.out.println(m.ordinal());
  }
}

The code above generates the following result.