We would like to know how to create and do calculation with DayOfWeek.
import java.time.DayOfWeek; import java.time.format.TextStyle; import java.util.Locale; //from w w w . j a v a 2 s .c o m public class Main { public static void main(String[] args) { System.out.println(DayOfWeek.MONDAY); System.out.println(DayOfWeek.TUESDAY); System.out.printf("%s%n", DayOfWeek.MONDAY.plus(3)); System.out.printf("%s%n", DayOfWeek.MONDAY.plus(401)); System.out.printf("%s%n", DayOfWeek.MONDAY.minus(401)); } }
The code above generates the following result.