File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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: 24168
    
  30

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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Allowable Interface modifier types
 
Similar Threads
Problem in interfaces..???
interface relationships
Packages Vs interfaces Vs Imports
interface implements
Abstract class and interfaces.