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.
The moose likes Beginning Java and the fly likes inner classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "inner classes" Watch "inner classes" New topic

inner classes

Marc Shiest
Ranch Hand

Joined: Jun 09, 2001
Posts: 46
hey my fellow Java Ranchers...what is the difference between a private inner class and a protected inner class?
Mikael Jonasson
Ranch Hand

Joined: May 16, 2001
Posts: 158
The same as the difference between a private and a protected member variable: The acces to it.
If you declare an inner class to be private, the only methods that can acces methods within that class are methods of the class encapseling that class. If you use protected, subclasses of the encapusing class may access it.
I agree. Here's the link:
subject: inner classes
jQuery in Action, 3rd edition