Abhijit Durge wrote:PS: InnerExtended needs to be inside a class extending Parent. In this case Child.
I see nothing wrong with what you've written (apart from maybe your names). However, to make
Inner extendable by ANY class that extends
Parent,
you should really make it
protected, viz:
protected class Inner { ...
However, my question would be: How often do you think you're going to need this information? True inner classes are rare enough, and their use tends to suggest finality, not extension. If it's for the
SCJP exam, then good luck with that; but the chances of you ever needing to use it in real life are slim to none (in eleven years of
Java programming, I haven't).
Winston