Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Both imports work for enums ?

 
Sreedevi Vinod
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I thought that only static import can be used to import static members of a class. And enums are static by default.
In the below code, I can replace the 'static import' with a normal import to use the enum which is defined inside EnumClass.
Still it works fine. Why so ?

 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The 'static import' construct is only a convenience. It is never required.
 
Sreedevi Vinod
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, but what I meant to ask is that there are some things you can do with static imports and not with normal imports - like importing static methods and variables of a class. But in the case of enums (as class members),both imports work, why is it so ?
[ September 13, 2005: Message edited by: Sreedevi Vinod ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic