It's not a secret anymore!
The moose likes Beginning Java and the fly likes static import Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "static import" Watch "static import" New topic

static import

ajaysharma fbd

Joined: Aug 06, 2012
Posts: 2
Do static-import feature also imports static inner classess???
Winston Gutkowski

Joined: Mar 17, 2011
Posts: 8927

ajaysharma fbd wrote:Do static-import feature also imports static inner classess???

I may be wrong, but I'm pretty sure that's why it was added. To be honest, I don't use them much, because I like to see the the outer class specified (more keystrokes for you, but a lot clearer for me ).

This is especially true when nested classes have generic names like 'Entry' or 'Builder'.


Bats fly at night, 'cause they aren't we. And if we tried, we'd hit a tree -- Ogden Nash (or should've been).
Articles by Winston can be found here
Stephan van Hulst

Joined: Sep 20, 2010
Posts: 4599

I like to import enum constants. Here's an example of how you could set up a chess board:

The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
I agree. Here's the link:
subject: static import
It's not a secret anymore!