
write a program in java to print day of a week with with respect to its number .for the illustration,if you give a number 4, it will print"wednesday" in this program,switch-case statement is expected to use.

import java.util.*;
public class DayType{
public static String findDay(int day){
switch (day){
case 1:
return "Sunday";
case 2:
return "Monday";
case 3:
return "Tuesday";
case 4:
return "Wednesday";
case 5:
return "Thursday";
case 6:
return "Friday";
case 7:
return "Saturday";
}
return "";
}
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
System.out.print("Enter day: ");
int day=input.nextInt();
String d=findDay(day);
System.out.println("Day is: "+d);
}
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.