For example, the following fragment is a valid nested switch statement.
public class Main {
public static void main(String args[]) {
for (int i = 0; i < 6; i++)
switch(i) {
case 0:
switch(i+1) { // nested switch
case 0:
System.out.println("target is zero");
break;
case 1:
System.out.println("target is one");
break;
}
break;
case 2: // ...
}
}
}
The output:
target is one
| w__ww__.___j__a__v___a___2___s.__co__m___ | Contact Us |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |