aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes abstract inner classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "abstract inner classes" Watch "abstract inner classes" New topic
Author

abstract inner classes

Ramnath krishnamurthi
Ranch Hand

Joined: Jan 22, 2003
Posts: 56
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
Krishna Srinivasan
Ranch Hand

Joined: Jul 28, 2003
Posts: 1844

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();
}
}


Krishna Srinivasan
Spring Tutorials, OCAJP Mock Questions, 400+ OCPJP Mock Questions
VP Jain
Ranch Hand

Joined: Feb 11, 2004
Posts: 81
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


SCJP SCWCD SCBCD <br /> <br />what u do in life echos in eternity!
 
Consider Paul's rocket mass heater.
 
subject: abstract inner classes
 
Similar Threads
Absract inner class
Inner class
Abstract Inner Classes
regarding classes inside interfaces
How do I extend an abstract inner class