aspose file tools
The moose likes Java in General and the fly likes Enum constants must be the first statement in enum class? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Badass: Making Users Awesome this week in the Game Development forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Enum constants must be the first statement in enum class?" Watch "Enum constants must be the first statement in enum class?" New topic
Author

Enum constants must be the first statement in enum class?

ZahidM Khan
Greenhorn

Joined: Apr 06, 2012
Posts: 8
Does the first statement of enum class must have to be a constant?

enum AnEnumClass{
CONSTANT1, CONSTANT2;
int a;
void aMethod(){}
}

VS

enum AnEnumClass{
int a;
void aMethod(){}
CONSTANT1, CONSTANT2;
}
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 62272
    
  68

Yes, the enum names must be first.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Enum constants must be the first statement in enum class?