KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SwitchInWhile


1 public class SwitchInWhile {
2
3     public static void main (String JavaDoc [] args) {
4     
5         int i = 0;
6         while (i < 10) {
7             switch(i % 2) {
8                 case 0 : {
9                              System.out.println("even");
10                              break;
11                          }
12                 case 1: {
13                             System.out.println("odd");
14                         }
15                 
16             
17             }
18
19             i++;
20         }
21     }
22 }
23
Popular Tags