• 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

abstract inner classes

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
How do we extend an abstract inner class?
I tried the following code
class TheOuter{
abstract class TheInner{
}
}
class TestInner extends TheOuter.TheInner{
public static void main(String[] args){
}
}
I am getting a compile time error that says

"TestInner.java": Error #: 478 : enclosing class innerclasses.TheOuter of class innerclasses.TheOuter.TheInner is not in scope


Any idea how to solve this?
If we cannot extend an innerclass,then what is the use of abstract inner classes?
Thanks in Advance
Ramnath

Feed an Opportunity.Starve a Problem

 
Ranch Hand
Posts: 1880
Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
class AbstractInner
{
abstract class Inner{
abstract void method();
}
class Inner1 extends Inner{
public void method(){
System.out.println("Implementing Abstract class");
}
}
public static void main(String[] args)
{
new AbstractInner().m();
}
public void m(){
new AbstractInner.Inner1().method();
}
}
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
For your question on what is the use of abstract inner classes ?

I would suggest you to view this link Thinking in Java by Bruce Eckel
web page
 
Get meta with me! What pursues us is our own obsessions! But not this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic