This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Inner Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Inner Class" Watch "Inner Class" New topic
Author

Inner Class

kapil apshankar
Ranch Hand

Joined: Dec 17, 2000
Posts: 66
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
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
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
koray guclu
Ranch Hand

Joined: Feb 23, 2001
Posts: 59
You can find more about inner classes from http://www.geocities.com/korayguclu/
Take care,

------------------
------------------------
Koray G��l�
(B.s. Computer Engineer)


-----------------------------------------------------<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>-----------------------------------------------------
 
jQuery in Action, 2nd edition
 
subject: Inner Class