| The Java Language | CS 161 - Java |
Source: examples/SwitchDemo.java
/** An example of the "switch" branching control flow statement
** @author Jonathan Doughty
**/
public class SwitchDemo {
public static void main(String args[]) {
switch (args.length) {
case 0:
System.out.println("usage: java IfDemo [other arguments]");
break;
case 1:
System.out.println("I didn't come here for an argument");
break;
default:
System.out.println("You gave me more then 1 argument");
break;
}
}
}
|
jwd |