The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Scoping

Posted by Edwin van der Elst on December 06, 2000 at 5:04 AM

You don't 'need' innerclasses, but they are usefull in a couple of situations.
An innerclass can access private & protected data from it's outerclass. If the innerclass was a normal class, this data would have to be public or accessable with get/set. Now, you can make just the innerclass public.

For eventhandlers, it is conventient to have an innerclass implement some listener interface, instead of the class itself.





Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us