public class Test { |
public static void main(String[] args) { |
int colorNum = 5 ; |
switch (colorNum) { |
case 0 : |
System.out.println(Color.red); |
break ; |
case 1 : |
System.out.println(Color.green); |
break ; |
default : |
System.out.println(Color.black); |
break ; |
} |
} |
} //源代码片段来自云代码http://yuncode.net |
|