Yes an inner class can be a subclass of the outer class. You can write a simple test program for yourself, compile it and see the results.
Nasir Khan
Ranch Hand
Joined: Nov 04, 2000
Posts: 135
posted
0
Thanks Junaid I tried with this code __________________________ class out { out(){System.out.println("out constructor");} void method(){ class inner extends out{ inner(){System.out.println("I'm in inner constructor"); } } new inner(); } }
class tes extends out{ public static void main(String [] arg){ new tes().method();} } _________________________________ As expected tes().method(); invokes out's constructor twice and inner's costructor once. Does anyone know any advantage of extending the outer class to inner class.