Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

inner interface?  RSS feed

 
jordan gong
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A top-level interface cannot be private or protected.
Can an inner interface be private or protected?
Thanks.
 
Jane Griscti
Ranch Hand
Posts: 3141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jordan,
An interface declared within a class can be 'private' or 'protected'. You cannot declare an 'inner interface' in an interface declaration.

Remember that all interface members are implicitly 'public', making it impossible to declare an interface inside an interface as 'private or protected'
Hope that helps.
------------------
Jane Griscti
Sun Certified Programmer for the Java� 2 Platform
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!