local variables are always on the stack. But where are instance variables? is it the stack or something else?
Sundar Murthi
Ranch Hand
Joined: Mar 05, 2004
Posts: 209
posted
0
Hi
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
Jeroen Wenting
Ranch Hand
Joined: Oct 12, 2000
Posts: 5093
posted
0
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.
42
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
posted
0
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!