Advertisement
Guest User

Untitled

a guest
Jun 18th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. public class Solution {
  2.     public static void main(String[] args) {
  3.         int x = 0;
  4.        
  5.         while(x <= 0)
  6.             x++;
  7.        
  8.         switch(x) {
  9.             default:
  10.                 System.out.println("default does not have to be at the start");
  11.        
  12.             case 0: {
  13.                 System.out.println("x is 0");
  14.                 System.out.println("x is 0");
  15.             }
  16.            
  17.             case 1:
  18.                 System.out.println("x is 1");
  19.                 System.out.println("x is 1");
  20.                
  21.             case 2: {
  22.                 System.out.println("There was no break statement so this prints too!");
  23.                 break;
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement