This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Re:inner classes" Watch "Re:inner classes" New topic
Author

Re:inner classes

sunil kumre
Ranch Hand

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

Joined: Apr 05, 2000
Posts: 1441
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.
John


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

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
 
 
subject: Re:inner classes
 
Similar Threads
Topic for JavaRanch Journal Article / SCJP Tipline
What is a class file with $ symbol in the name
WA #1.....word association
Codebase
Problem finding property file with Resource Bundle