A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Programmer Certification (SCJP/OCPJP)
Joined: Mar 01, 2004
Jun 15, 2004 05:26:00
local variables are always on the stack.
But where are instance variables?
is it the stack or something else?
Joined: Mar 05, 2004
Jun 15, 2004 06:02:00
Instance variables are in memory.
When ever an new object is created its instance variables are allocated in object refference memory.Ie object itself contains the instance variables.
The name "instance variable " itsef u can understand that one
i hope it will help u
Joined: Oct 12, 2000
Jun 15, 2004 06:28:00
instance variables live on the heap, which is basically just a raw chunk of RAM managed by the JVM.
Think of the stack as the queue in front of the checkin desk at an airport, the heap would be the departure launch where everyone mingles with no apparent order but will get to the right exit in time.
Joined: Aug 03, 2002
Jun 15, 2004 07:27:00
Think of the stack as the queue in front of the checkin desk at an airport
I wish it was. The last arrival would be first to get checked in!
Ask a Meaningful Question
Getting someone to think and try something out is much more useful than just telling them the answer.
I agree. Here's the link:
subject: instance variables
Stack & heap for Static methods
stack, heap, ...
implementation for static and non-static methods stored in memory
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014