Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Pityu Szíviso
Added: Nov 28, 2018 8:18 PM
Views: 1
Tags: switch
  1.  switch (score){
  2.  
  3.             case 100:                           // get executed, but next line also since no break;
  4.                 System.out.println("test");     // this line is not executed
  5.             case 90:
  6.                 System.out.println("Very good");
  7.                 break;                          //stops switsch
  8.             case 60:
  9.                 System.out.println(" Good");
  10.                 break;
  11.             default:                            // if none of the cases is true -> "else'
  12.                 System.out.println(" The grade are not defined");
  13.         }