This is a follow-up question to How are static arrays stored in Java memory? .
So global variables in C/C++ are stored in the static data segment of memory. But what
Static variables will not be stored in Heap.. They are part of Data Segment. Local variables will be stored in - Stack; Instance variables will be stored in - Heap; Class variables(Static) will be stored in - Data Segment. These variables will be shared across all objects of that class.. Your final machine equivalent java code will be stored in - Code/text segment.