Hi, Can an inner class be a subclass of the outer class? I think this is not legal. An inner class can extend any other class or interface. Correct me if I am wrong. Regards Kapil
Hope this helps. Correct me if I am wrong.<p>Cheers <img src="smile.gif" border="0"> ,<br />Kapil
Stevie Kaligis
Ranch Hand
Joined: Feb 04, 2001
Posts: 400
posted
0
try this : public class TestClass { TestClass() {} TestClass(int x) {} class Inner extends TestClass { Inner() {} Inner(int y) {} } public static void main(String[] args) { new TestClass().new Inner(); } }
stevie
Cindy Glass
"The Hood"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
posted
0
You can do it, but WHY? You don't gain anything. You already had access to all of the members of the outer class.
"JavaRanch, where the deer and the Certified play" - David O'Meara
-----------------------------------------------------<BR> Koray GUCLU ~ the sky has no limit ~<BR> (B.s. Computer Engineer)<BR> Frankfurt am Main, Germany<BR> web : <A HREF="http://www.geocities.com/korayguclu/<BR rel="nofollow">" TARGET=_blank>http://www.geocities.com/korayguclu/<BR></A> mail: korayguclu@yahoo.com<BR>-----------------------------------------------------