File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Both imports work for enums ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Both imports work for enums ?" Watch "Both imports work for enums ?" New topic
Author

Both imports work for enums ?

Sreedevi Vinod
Ranch Hand

Joined: Jan 17, 2005
Posts: 117
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

Joined: Oct 25, 2000
Posts: 7292

The 'static import' construct is only a convenience. It is never required.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Sreedevi Vinod
Ranch Hand

Joined: Jan 17, 2005
Posts: 117
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Both imports work for enums ?