日期:2014-05-18 浏览次数:20858 次
private static void test(char c) {
switch (c) {
case 'H':
test1();
case 'O':
test2();
case 'J':
test3();
......
}
}
------解决方案--------------------
是String就不行,那可以用enum来实现
Java code
public static enum Level {
/** */
HGG,
/** */
KGG,
/** */
OGG,
/** */
JGG
};
private static void test(Level c) {
switch (c) {
case HGG:
test1();
case KGG:
test1();
case OGG:
test2();
case JGG:
test3();
......
}
}
------解决方案--------------------
呵呵!