File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Inner Class" Watch "Inner Class" New topic

Inner Class

kapil apshankar
Ranch Hand

Joined: Dec 17, 2000
Posts: 66
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.

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();

Cindy Glass
"The Hood"

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
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="<BR rel="nofollow">" TARGET=_blank><BR></A> mail:<BR>-----------------------------------------------------
I agree. Here's the link:
subject: Inner Class
It's not a secret anymore!