I just started learning myself Java. Thought of writing a "Switch case" program like to get a input string from user and thought of displaying the day. Even though it did not show any errors in my Eclipse IDC but my below program is not running.
Could someone tell me what is the error in my below program?
package MyExercies;
import java.util.Scanner;
public class sampleSwitchCase
{
public static void main(String[] args)
{
Scanner S = new Scanner(System.in);
String Day = S.nextLine();
int weekday = Integer.valueOf(Day);
S.close();
switch(weekday)
{
case 1:
System.out.println ("The given day is Week begining day - Monday");
break;
case 2:
case 3:
case 4:
System.out.println ("The given day is Mid of Weekday");
break;
case 5:
System.out.println ("The given day is Weekend - Friday");
break;
case 6:
case 7:
System.out.println ("The given day is End of the Week");
break;
}
}
}