• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

about inner classes

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic