Free Flowing Switch Statement - Java Language Basics

Java examples for Language Basics:switch

Description

Free Flowing Switch Statement

Demo Code

public class Main {
 
        public static void main(String[] args) {
                 int i=0;
                 switch(i)
                 {//from   w  w  w .j av a 2  s .c  o m
                        case 0:
                                System.out.println("i is 0");
                               
                        case 1:
                                System.out.println("i is 1");
                               
                        case 2:
                                System.out.println("i is 2");
                               
                        default:
                                System.out.println("Free flowing switch example!");
                 }
        }
}

Result


Related Tutorials