Java Date Time - DayOfWeek values() example








DayOfWeek values() returns an array containing the constants of this enum type, in the order they are declared.

Syntax

values has the following syntax.

public static DayOfWeek[] values()

Example

The following example shows how to use values.

import java.time.DayOfWeek;

public class Main {
  public static void main(String[] args) {
    for (DayOfWeek c : DayOfWeek.values()){
       System.out.println(c);
    }
  }
}

The code above generates the following result.