Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Static members stored in heap or stack??

796745Feb 8 2008 — edited Feb 11 2008
Hi,

I had some doubt regarding where the static members of a class are stored. As you all know, we need not have an instance of a class to use its static members (instance variables or methods). Then where these static members are stored, i.e. on heap or stack?? As far as I know, only local variables or non-static methods are stored on the stack.. And only objects live on the heap!!

Also, when we initialize an object [say new Object()], and if class Object has some static members, would there again be a reference of the static members in the heap inside the object??

Please clear my doubt..
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 10 2008
Added on Feb 8 2008
18 comments
7,066 views