DayOfWeek values() example

Description

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;
//from w w w  . java  2s  .co m
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.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset