Source Code
Scanner scanner = new Scanner(System.in);
System.out.println("Enter the day");
String day = scanner.nextLine();
switch (day){
case "Sunday":
System.out.println("This is a resting day");
break;
case "Monday":
System.out.println("You have to report at work today");
break;
case "Tuesday":
System.out.println("You will have a meeting at your office");
break;
case "Wednesday":
System.out.println("Create schedule for the coming meeting");
break;
case "Thursday":
System.out.println("Go to dinner with Family");
break;
case "Friday":
System.out.println("Have a nap");
break;
case "Saturday":
System.out.println("Go to the laundry");
break;
default:
System.out.println("Not a day of the week");
break;
}
System.out.println("Enter a your choice" +
"\n\t1. Buy a data" +
"\n\t2. Check data balance" +
"\n\t3. Exit");
int choice = scanner.nextInt();
switch (choice){
case 1:
System.out.println("You are buying a data");
break;
case 2:
System.out.println("Checking data balance");
break;
case 3:
break;
default:
System.out.println("Invalid input");
break;
}
On this page of the site you can watch the video online Switch case in Java made simple with sample source code. with a duration of hours minute second in good quality, which was uploaded by the user Tech With Nate 12 December 2021, share the link with friends and acquaintances, this video has already been watched 32 times on youtube and it was liked by 2 viewers. Enjoy your viewing!