Skip to Main Content

Developer Community

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!

Where is the static variable stored?

Cheolmin LeeApr 21 2025 — edited Apr 21 2025

let's say i have declared like this:

static int x = 1;

Where does the variable and value is stored?

Some say while existence cursor of variable is stored in metaspace, the value of it will be stored in heap memory,

and others say the variable and value both will be stored in metaspace.

Which one is the right statement?

P.S: And if you can, can you give me a reference of info. too?

Comments
Post Details
Added on Apr 21 2025
0 comments
244 views