Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A static enumeration

 
Mrinal Singhania
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

The below code compiles fine even if the "static" keyword is removed for the enum declaration.



Can someone please explain?

Thanks.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the Java Language Specification:
Nested enum types are implicitly static. It is permissible to explicitly declare a nested enum type to be static.

So it doesn't matter if you declare it as static or not, it will be treated as if it was.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic