Can anyone tell me a real time example for inner classes?
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.