aspose file tools*
The moose likes Beginning Java and the fly likes inner class, when ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "inner class, when ??" Watch "inner class, when ??" New topic
Author

inner class, when ??

Rajeev Ravindran
Ranch Hand

Joined: Aug 27, 2002
Posts: 455
hi all,
could any one tell me the use of inner classes ??
when is it used ??
thanks
raj


SCJP, SCWCD, SCBCD, Oracle Certified Professional (SQL n PL/SQL)
Frank Hale
Ranch Hand

Joined: Mar 25, 2000
Posts: 230
Its probably a matter of preference when to use it. However its extremely useful when adding listeners to Swing components. Thats where I've seen it used extensively.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
If you have a class that is so tied to another class that it makes no sense for the one class to exist without the other.
An example from the API is the Entry class which is an inner class of the Map class. Entry represents a key-value pair in a Map so it makes sense to make Entry an inner class of Map.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: inner class, when ??
 
Similar Threads
inner interfaces??
Private
Everyone's help needed!!!! @@
Inner class
werid output for For loop