Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

default case in Java switch-case

class Main {
  public static void main(String[] args) {
      int expression = 9;
        switch(expression) {
        
      case 2:
        System.out.println("Small Size");
        break;

      case 3:
        System.out.println("Large Size");
        break;
            
      // default case
      default:
        System.out.println("Unknown Size");
    }
  }
}
 
PREVIOUS NEXT
Tagged: #default #case #Java
ADD COMMENT
Topic
Name
3+8 =