I'm not sure what "an abstact/non-abstract class" is, but have you tried using an abstract nested class? It works very much like a top-level abstract class.
Does it make any sense in real world to make an inner class abstract??
Absolutely. If your class requires the use of a number of other classes that are related to each other (ie form a class hierarchy) and those classes are particular to the parent class (ie are ideal candidates for implementation as inner classes) then it is probable that the super class of the inner class hierarchy will be abstract.
Originally posted by marc weber: I'm not sure what "an abstact/non-abstract class" is, but have you tried using an abstract nested class? It works very much like a top-level abstract class.
Mark, I meant abstract or a non abstract top level class but specifically having a nested abstract inner class .
How do I extend this abstract inner class?
Is it of any value if I make the nested inner class abstract?
Absolutely. If your class requires the use of a number of other classes that are related to each other (ie form a class hierarchy) and those classes are particular to the parent class (ie are ideal candidates for implementation as inner classes) then it is probable that the super class of the inner class hierarchy will be abstract.
Tony, I meant marking the nested inner class abstract, not the outer class! Does it make sense?
Is it of any value if I make the nested inner class abstract?
Tony's explanation applies to abstract classes in general, whether they are top-level or nested. It's the same idea, just in the context of an enclosing class.
As for how to extend an abstract nested class... It's the same as extending a concrete nested class, except that you need to implement any abstract methods (just as you would if you were extending a top-level abstract class).
The best way to learn about this is to try writing some code.
Tony's explanation applies to abstract classes in general, whether they are top-level or nested. It's the same idea, just in the context of an enclosing class.
As for how to extend an abstract nested class... It's the same as extending a concrete nested class, except that you need to implement any abstract methods (just as you would if you were extending a top-level abstract class).
The best way to learn about this is to try writing some code.
Mark, After a bit of fighting I did this.
When I had posted the question I tried to do something like this:
Does this imply that the outer class needs to be extended before any of the inner classes can be extended ?. I guess it does not make sense to directly inherit an inner class.
Originally posted by Muni K Reddy: ... Does this imply that the outer class needs to be extended before any of the inner classes can be extended ? ...
Not necessarily, because you can extend a nested class within the same enclosing class. For example...
Also note that in your code, A1 extends Test, so A1 inherits the nested class TestINNER. Therefore, you can just say "A2 extends TestINNER" instead of "A2 extends Test.TestINNER."