KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SimpleSwitch


1 public class SimpleSwitch {
2
3     public static void main(String JavaDoc [] args) {
4         SimpleSwitch ss = new SimpleSwitch();
5         ss.run(7);
6     }
7     
8     public void run(int i){
9     
10         switch(i){
11             case 2: {
12                 System.out.println(2);
13                 break;
14                     }
15             case 7: {
16                 System.out.println(7);
17                 break;
18                     }
19              default: {
20                 System.out.println("default");
21                 break;
22                       }
23         
24         }
25     }
26     
27 }
28
Popular Tags