Java DayOfWeek add day to day of week

Description

Java DayOfWeek add day to day of week

import java.time.DayOfWeek;

public class Main {
  public static void main(String[] args) {
    // Obtain a DayOfWeek instance using an int value
    DayOfWeek dw2 = DayOfWeek.of(7); // SUNDAY
    System.out.println(dw2);//ww  w  . j  a va 2  s .c o m
    
    // Add one day to the day-of-week to get the next day
    DayOfWeek dw3 = dw2.plus(1); // MONDAY
    System.out.println(dw3);
    
  }
}



PreviousNext

Related