我可以从两个枚举创建一个枚举(在 switch 语句中使用的常量)吗???
就像是...
public class Test{
public enum WorkDay {Monday, Tuesday, Wednesday, Thursday,Friday};
public enum WeekEndDay {Sunday, Saturday};
// it doesn't work ):
public enum Day{WorkDay.values(),WeekEndDay.values()};
public static void Action(Day d) {
switch(d){
case Monday:
...;
break;
case Tuesday:
...;
break;
case ...:
...;
break;
case Saturday:
...;
break;
}
}
}
任何的想法???我真的很想使用switch并分离了枚举谢谢!!!