2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by BestJewSinceJC
0

Not sure if that is a homework question or not, but that is a good question. Here is one example I found on the web, it seems legitimate, and it makes a good point that you would not be able to have the same functionality without the inner class. http://www.sbras.ru/win/docs/java/tutorial/java/javaOO/innerclasses.html

The Java tutorials also make a few good points about inner classes in Swing, go down to "Inner classes and Anonymous inner classes" here http://java.sun.com/docs/books/tutorial/uiswing/events/generalrules.html

Page two of this article I found on JavaWorld is particularly interesting as well. It demonstrates why inner classes are useful for programming GUIs, using the simple example that multiple buttons probably have different functionality (for each button), so separating the logic using inner classes might be ideal.
http://www.javaworld.com/javaworld/javaqa/2000-03/02-qa-innerclass.html?page=1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.