aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes member declaration with in a interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "member declaration with in a interface" Watch "member declaration with in a interface" New topic
Author

member declaration with in a interface

Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
Every member type declaration(classes as well as interfaces)
appearing within the body of a directly enclosing interface is
implicitly static and public.

Any logical reason why they are implicitly static?


Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Conversely, any logical reason why they wouldn't be?
Think about it some more


Tony Morris
Java Q&A (FAQ, Trivia)
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
You cannot refer to "this" inside a interface. Hence there is no point in
going for a non-static member interface. But why the same for member class
inside an interface.
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
To create the innner class you would need an instance of the containing class but there is no such thing: it's an interface. Ignoring that, what benefit would you derive with an inner class instance? Access to package and private scope fields and methods? There are none.
 
wood burning stoves
 
subject: member declaration with in a interface