xFactorSchool.com(Beta)
How to Do Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Editor
C Code Editor
C++ Code Editor
C# Code Editor
Java Code Editor
Python Code Editor
HTML Code Editor
CSS Code Editor
JavaScript Code Editor
Practice how to use switch in Java
Java Online Editor
Execute Code
More Java Sample Codes
import java.time.LocalDate; //import class import java.time.DayOfWeek; //import class public class ExampleApp { public static void main(String[] args) { DayOfWeek dayOfWeek = LocalDate.now().getDayOfWeek(); // Get today's day of the week switch (dayOfWeek) { case SUNDAY: //This code will be executed, if the day name is SUNDAY... System.out.println("Today is " + dayOfWeek); break; case MONDAY: System.out.println("Today is " + dayOfWeek); break; case TUESDAY: System.out.println("Today is " + dayOfWeek); break; case WEDNESDAY: System.out.println("Today is " + dayOfWeek); break; case THURSDAY: System.out.println("Today is " + dayOfWeek); break; case FRIDAY: System.out.println("Today is " + dayOfWeek); break; case SATURDAY: System.out.println("Today is " + dayOfWeek); break; default: System.out.println("It is not a day of the week."); break; } } }