【发布时间】:2017-03-06 15:38:34
【问题描述】:
private static int counter = 0;
public static final int CLIENT_REQUEST_TIME = 计数器++;...
switch(命令){
case Command.CLIENT_REQUEST_TIME:...
但它来了
"错误:(20, 25) java: 需要常量表达式",
案例陈述。
但究竟为什么呢?因为 CLIENT_REQUEST_TIME 是常数
我知道这应该是针对 Oracle 的,我可以从数百万种解决方法中进行选择...但以防万一有人能看到背后的一些逻辑,它肯定会让我今晚睡得更好:)
【问题讨论】:
标签: switch-statement case constants final