KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > T1410f2


1
2 class T1410f2 {
3     static void howMany(int k) {
4         switch (k) {
5             case 1: System.out.println("one");
6             break; // exit the switch
7
case 2: System.out.println("two");
8             break; // exit the switch
9
case 3: System.out.println("many");
10             break; // not needed, but good style
11
}
12     }
13     public static void main(String JavaDoc[] args) {
14         howMany(1);
15         howMany(2);
16         howMany(3);
17     }
18 }
19     
Popular Tags