File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes about 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 » Java » Java in General
Bookmark "about inner classes" Watch "about inner classes" New topic
Author

about inner classes

Rajesh Tarigopula
Greenhorn

Joined: Oct 19, 2004
Posts: 8
Hi,
we can declare an inner class as abstract or final. Then where and how we can impliment the abstract methods of an inner class and what is the meading of making an inner class final.

Similary if we declare an inner class as method local with abstract or final
then where and how we can impliment the abstract methods of an inner class and what is the meading of making an method inner class final.

how can we inherit an inner class if it is not final.

Thanks & Regards
Rajesh
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
Yes an inner class can be abstract or final (but not both).
A final inner class simply cannot be inherited from.
An abstract inner class cannot be instantiated and typically contains one or more inner classes (less common that final inner classes in my experience).

Hope this helps.


Tony Morris
Java Q&A (FAQ, Trivia)
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
you could do something like this:


how useful that is remains to be seen
Probably you could also declare the outer class as abstract and defer implementation of the abstract inner class to childclasses of the outer class like this: (I haven't tried any of this, mind)


which seems more useful by far.

P.S. corrected code so it now compiles (doh) and indeed it compiles.

[ October 20, 2004: Message edited by: Jeroen Wenting ]
[ October 20, 2004: Message edited by: Jeroen Wenting ]

42
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: about inner classes
 
Similar Threads
abstract class
Abstract inner classes
local-method inner class
Question is ambigitive
thread