This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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?
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.