Why do I get an Enum constant reference cannot be qualified in a case label?

Posted by maleki on Stack Overflow See other posts from Stack Overflow or by maleki
Published on 2010-04-18T21:11:37Z Indexed on 2010/04/18 21:13 UTC
Read the original article Hit count: 173

Filed under:
|
|

Why does the following code fail to compile while changing the case statement to

case ENUM1: doSomeStuff();

works?

public enum EnumType
{
    ENUM1, ENUM2, ENUM3;

    void doSomeStuff()
    {
        switch(this)
        {
        case EnumType.ENUM1: doSomeStuff();
        }
    }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about enums