Static fields and methods [duplicate]
Possible Duplicate:
Java: where do static fields live within the memory?
Java uses the heap to save objects and instance variables and the stack for storing methods and local variable. I want to know where static feilds and methods are stored.
static fields --
开发者_如何学Pythonstatic methods --
Your question itself contains an error: methods themselves aren't stored anywhere that you have access to; there is a special "method space" where loaded code goes. Static fields are stored inside class definitions, which are stored in a special heap area called "PermGen space"; static methods, like normal methods, aren't stored in normal Java storage.
精彩评论