• 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

method local inner classes

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a small doubt .. Guys..

In a method,any local variable is placed on a stack...
I think the same case is with any local objects instantiated.

But where are the objects instantiated within method local inner classes
placed?

I guess its the garbage collectible heap.

Am I right?
Can anyone justify my answer?

Thanks in advance...
rajani.
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Java, all objects are created on the heap. There isn't an exception that I'm aware of. Therefore, even an instance of a local class would be created on the heap. Of course, any reference variables that refer to that object would be found in the activation stack.
 
reply
    Bookmark Topic Watch Topic
  • New Topic