GeeCON Prague 2014*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes instance variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "instance variables" Watch "instance variables" New topic
Author

instance variables

Angela lewis
Ranch Hand

Joined: Mar 01, 2004
Posts: 100
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
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
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
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 and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
 
GeeCON Prague 2014
 
subject: instance variables