aspose file tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes static import and enums Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "static import and enums" Watch "static import and enums" New topic

static import and enums

Paul Prusko

Joined: Feb 16, 2008
Posts: 25
Hi Ranchers,
I think highly of your time so if you find a minute, please, consider the following:
In case we define an enum inside a class in one package and then would like to use it in another one, what is the proper way to import it: static import or "classic" import statement since I noticed they both work and allow to use the enum name without class qualification. Similar question applies to members which are static nested classes. What do you think is correct? Appreciate your involvement.
Joe Fischer

Joined: May 02, 2008
Posts: 25
That's a matter of style. I'm not sure that "import static" makes codes easier to read, but that's my opinion.

I agree. Here's the link:
subject: static import and enums
jQuery in Action, 3rd edition