Java Date Time - Month APRIL example








Month APRIL defines the singleton instance for the month of April with 30 days.

This has the numeric value of 4.

Syntax

APRIL has the following syntax.

public static final Month APRIL

Example

The following example shows how to use APRIL.

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

The code above generates the following result.