wood burning stoves*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Outer class instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Outer class instance" Watch "Outer class instance" New topic
Author

Outer class instance

Doit
Ranch Hand

Joined: Aug 03, 2000
Posts: 169
non static inner class - we need an outer class instance.
static inner class - we do not need an outer class instance.
what about local inner classes?
- Thanks
Ada Wang
Greenhorn

Joined: Aug 28, 2000
Posts: 23
For static local inner class, no outer class instance need.
For non static local inner class, it depends on whether the enclosing method is static or not.
manal
Ranch Hand

Joined: Aug 17, 2000
Posts: 45
local classes r not a part of outer classes ...
u even cant use them outside the method ...
so there is no chance to instantiate them where u need any outer reference ..
manal
Sunita Vontel
Ranch Hand

Joined: Aug 28, 2000
Posts: 72
what is the difference between local classes and local inner classes??
manal
Ranch Hand

Joined: Aug 17, 2000
Posts: 45
local classes nd local inner classes r one nd the same thing ....
they r diclared inside a block of code nd could only be used inside that block .. they r not a member of enclosing class ...
manal...
Doit
Ranch Hand

Joined: Aug 03, 2000
Posts: 169
Thanks manal.
what about assosiation of outer class reference?
I read that nonstatic inner classes are assosiated with outer class reference, but static inner classes are not.
What about local inner classes? How does this assosiation terminology and requirement of outer class instance terminology related?
- Thanks.



[This message has been edited by Doit (edited August 29, 2000).]
manal
Ranch Hand

Joined: Aug 17, 2000
Posts: 45
hi doit
static inner classes r just like outer classes ...they dosent neeed any instance of outer class .. they r just using the class name of outer class ..(not the object reference )....
now .. member classer r a part of outer classes just like instance methods ....
local classes r just like automatic variables .... they cant be used outside the method where they r diclared ...but the objects created lives much longer after the exit frm the method
manal ...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Outer class instance
 
Similar Threads
Inner Class
Confused with inner and nested classes
Inner Class
About static nested class???
Inner Class