Why can't an enum value be fully qualified in a switch statement?

前端 未结 1 2022
春和景丽
春和景丽 2020-12-20 11:31

(note: edited question; the prior intent was not clear)

Consider this code:

public final class Foo
{
    private enum X
    {
        VALUE1, VALUE2
         


        
相关标签:
1条回答
  • 2020-12-20 11:59

    SwitchLabel expects an EnumConstantName, which is defined as the enum constant identifier, which is unqualified:

    EnumConstant:
    Annotationsopt Identifier Argumentsopt ClassBodyopt

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