Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Enum constants must be the first statement in enum class?  RSS feed

 
ZahidM Khan
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the enum names must be first.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!