This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes static interface?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "static interface??" Watch "static interface??" New topic

static interface??

william kane
Ranch Hand

Joined: Nov 21, 2000
Posts: 260
When and where do i have to use a static interface?

Help me!Help you!!!
Rob Ross

Joined: Jan 07, 2002
Posts: 2205
The only place where you can have a static interface is when you declare an interface as a class member; in that case, the interface *must* be static. This effectively makes it a top-level interface, but means that when you use it outside the enclosing class, you must qualify the interface's name with the name of the enclosing class.

To use Bar outside of Foo, you must qualify the name like this:
Foo.Bar myBarObject;

SCJP 1.4
I agree. Here's the link:
subject: static interface??
Similar Threads
Can a class be defined in an interface?
nested interface
Interface doubt