• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Outer class instance

 
Doit
Ranch Hand
Posts: 169
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 72
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the difference between local classes and local inner classes??
 
manal
Ranch Hand
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 169
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic