This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
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 Java Interview Guide this week in the Jobs Discussion 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
It's not a secret anymore!