my dog learned polymorphism*
The moose likes Beginning Java and the fly likes Allowable Interface modifier types Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Allowable Interface modifier types" Watch "Allowable Interface modifier types" New topic
Author

Allowable Interface modifier types

Chris Allen
Ranch Hand

Joined: Feb 01, 2003
Posts: 127
In one of the Java books I am reading/experimenting with, it states that "interfaces can have acces modifiers of pulic or blank, similar to classes." My question is why can't that list include protected? An interface can be extended which in my mind, means that protected would be valid as well if you want to control what classes/other interfaces have access to it. Am I reading into the statement too much that protected is not allowed or is it just that it was not mentioned in the statement specifically?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Originally posted by Chris Allen:
My question is why can't that list include protected?


Top-level classes can't be protected, only methods can be, and interfaces are no different. All the methods in an interface are always implicitly public; the interface itself can be public or not, just like a class.


[Jess in Action][AskingGoodQuestions]
 
 
subject: Allowable Interface modifier types