Ok Instance variables are kept with their objects on the Heap but what about static instance variables? Where are they kept? Since there is one variable per class regardless of how many objects are created, are they stored outside of the object on the heap or are they put on the stack?
posted 11 years ago
See this post with a very erudite answer from Ernest.
The short answer is, it depends. It's not the stack. It may be the heap, but technically it can't be. It's in some memory that the JVM has access to that isn't the heap. That's what I understood. Oh, and it doesn't matter.