File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Re:inner classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Re:inner classes" Watch "Re:inner classes" New topic

Re:inner classes

sunil kumre
Ranch Hand

Joined: Dec 23, 2000
Posts: 64
What is the need for having inner classes?
John Wetherbie

Joined: Apr 05, 2000
Posts: 1449
Inner classes are good to use in cases where the inner class is tightly coupled to the class it is inside of. The inner class is doing working for the outer class that the outer class shouldn't be directly responsible for. I've seen/used inner classes as iterators, event handlers, and implementation providers.

The only reason for time is so that everything doesn't happen all at once.
- Buckaroo Banzai
Rick Edgecombe

Joined: Jan 17, 2001
Posts: 2
They also make code easier to read (in most cases). And, as we all know, readable code is maitainable code.

Tony Chen
Ranch Hand

Joined: Jan 29, 2001
Posts: 286
Just read this article @ JavaWorld:
Java Tip 106: Static inner classes for fun and profit
[This message has been edited by Tony Chen (edited January 30, 2001).]

SCJP Java 2 - IBM Certified Enterprise Developer - WebSphere V4.0 & V5.0 - IBM Certified System Administrator - WebSphere Network Deployment V6.0 - Canadian Securities Course (CSC) Certification
I agree. Here's the link:
subject: Re:inner classes
It's not a secret anymore!