Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Static I.C extending I.C  RSS feed

 
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Shah Chunky
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!