|
Normally, I've seen Inner Classes used for things like implementing an Iterator for a collection, an event handler, or perhaps some default strategies for a class. I've personally also used them for implementing a Runnable that maintains a class (a monitor thread, or cleaner process, etc). You can get yourself into some trouble using inner classes, since they have access to everything in the enclosing class at runtime. This can promote bad programming practice. However, being able to defining Event handlers in right inside the GUI classes that needs them is very nice. Here's a link to an entry on the Sun Java forum about the exact issue you are referring to: http://forum.java.sun.com/thread.jsp?thread=535839&forum=31&message=2589679 Just my 2 cents. Chris DeLashmutt Senior R&D Analyst LeasePlan USA 1165 Sanctuary Pkwy., Alpharetta, GA 30004 Phone: 678-202-8695 Fax: 678-921-4895 ClearCase problems? Check out the LeasePlan ClearCase FAQ for answers! "Bartell, Aaron L. (TC)" To: "Java Programming on and around the iSeries / AS400" <ALBartell@taylorco <java400-l@xxxxxxxxxxxx> rp.com> cc: Sent by: Subject: public classes within public classes java400-l-bounces@m idrange.com 11/15/2004 02:00 PM Please respond to Java Programming on and around the iSeries / AS400 Hi all, I just came across some code that has embedded classes within classes and was surprised because I didn't know that was a feature of the language (guess I have been doing Java longer than I thought - since 1.1). Example Public class MyClass { // methods and such public class MyInnerClass { // methods and such } } Anyway, what I am wondering is if there are any huge drawbacks to going this route. I came across it in the code that the Web Interaction Wizard in WDSc created for me. In this specific scenario it seems to be a good fit because the outer class defines an RPG program to call, and the inner classes define the input and output data structures that are passed. Thoughts? Aaron Bartell -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.