Enum within an enum

I believe that in Java, you can simply nest enums, as long as your non-enum constants come first.

enum Action
{
    FOO,
    BAR;
    enum MOVE
    {
         UP,
         DOWN,
         LEFT,
         RIGHT 
    }
}

This compiles for me and gives me the behavior you were looking for.

Leave a Comment