Where exactly are we going to use inner classes? I've looked through a good bit of the API and haven't seen one place where inner classes were used. I don't have any real world experience, so maybe you use inner classes in every program on the job, I don't know. I just fail to see where using an inner class is the best way to go.
Michael J Bruesch<br /><i>I code, therefore I am.</i>
everytime instead of making a class outside the main class and then making an object to access its functions , you can use inner classes. for eg: inner classes can be very effectively used when u write codes using event handling. eg2: while using GrifBag layout manager.
In addition to the two uses above, I also use them alot when I'm using threads... you get all the advantages of a Runnable object ( i.e. local attribute and method calls ) , but you can have more than one run() method...
-Nate
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
You would use an inner class anytime you wanted to hide a class from everyone else. I have not used them a lot but I ran into one example in which they were helpful. I had a class on which I wanted to keep some simple statistics. I wanted all the statistics code to live in its own class, but didn't want anyone else to use this statistics class. So I made this stats code an inner class.
Please ignore post, I have no idea what I am talking about.