File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Static I.C extending I.C Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Static I.C extending I.C" Watch "Static I.C extending I.C" New topic
Author

Static I.C extending I.C

Shah Chunky
Ranch Hand

Joined: Dec 27, 2000
Posts: 116
Hello all...
Static I.C extending I.C
Can someone tell me whether a Static Inner Class can extends a Non Static Inner Class from within the same class or from Other Class ?
Especially how can a static inner class extend other Non static inner class
from Other Outer class.
Can i do something like :-
class Other
{
class Osic{}
}
class Client
{
static class ClienInner extends Other.Osic{}
}
I think the above does'nt work.
So how to extends Other Non Static Inner class ?
Thanks.


Shah Chunky - Sun Certified Java2 Programmer.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
A ststic inner class can not extend non-static inner classes. It can extend other static inner classes. So this works:
<pre>
public class Other
{
static class Osic{}
}
class Client
{
static class ClientInner extends Other.Osic{}
}
</pre>
------------------
Co-Moderator of the Programmer Certification Forums


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Shah Chunky
Ranch Hand

Joined: Dec 27, 2000
Posts: 116
This was in JQ+
"A Static inner class cannot extend another Non Static inner class within
the same class, but in general there is no restriction."
So i think it means that v can extend Non static inner class declared outside
the Enclosing class i.e. from other Top Level class.
Can anyone has any input.
Thanks
 
jQuery in Action, 2nd edition
 
subject: Static I.C extending I.C