Java switch statement: Constant expression required, but it IS constant

前端 未结 13 1424
予麋鹿
予麋鹿 2020-11-22 10:42

So, I am working on this class that has a few static constants:

public abstract class Foo {
    ...
    public static final int BAR;
    public static final          


        
相关标签:
13条回答
  • 2020-11-22 11:28

    This was answered ages ago and probably not relevant, but just in case. When I was confronted with this issue, I simply used an if statement instead of switch, it solved the error. It is of course a workaround and probably not the "right" solution, but in my case it was just enough.

    0 讨论(0)
提交回复
热议问题