Switch Statement with break in java, Select a day from week by switch statement

Java Programming Language Decision Making in java (Article) Decision Making in java (Program)

7208

Program:

 class SwitchSelectDay{
  public static void main(String[] args)
  {
  int week = 6;

  switch (week)
      {
      case 1:
            System.out.println("monday");
            break;
      case 2:
            System.out.println("tuesday");
            break;
      case 3:
            System.out.println("wednesday");
            break;
      case 4:
            System.out.println("thursday");
            break;
      case 5:
            System.out.println("friday");
            break;
      case 6:
            System.out.println("saturday");
            break;
      case 7:
            System.out.println("sunday");
            break;
      default:
            System.out.println("Invalid week");
            break;
      }
  }
}

Output:

saturday
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.