I understand that inner classes can be declared as public, private or protected. How is it used? � What�s the difference in access between an inner class that is defined as private versus one which is defined as public? Thanks, Dan
William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
The access modifiers act the same as any regular identifier. If your inner-class is public, you can create an instance of the inner-class from any other class outside of the outer-class (with the caveat that since the inner-class is not static, you must first have an instance of the outer-class). If the modifier is private, only the outer-class is able to create an instance of the inner-class, you won't be able to instantiate an object of the inner class elsewhere. Again, you must have an instance of the outer-class to do this. See http://www.javaranch.com/campfire/StoryInner.jsp for a very nice story on inner classes Hope this helps, Jason