title: Where are static class variables stored in memory?
body: <p>This is a follow-up question to <a href="https://stackoverflow.com/questions/6654803/how-are-static-arrays-stored-in-java-memory">How are static arrays stored in Java memory?</a> .</p>
  
  <p>So global variables in C/C++ are stored in the static data segment of memory. But what about static class variables in Java/C++?</p>
  
  <p>It can't be the static data segment because you don't know what/how many classes are going to be referenced throughout the duration of your program (because of reflection). It's definitely not the stack because that makes no sense. Storing it on the heap is also kind of iffy.</p>