• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Outer class instance

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the difference between local classes and local inner classes??
 
manal
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic