开发者

Static fields and methods [duplicate]

This question already has answers here: Closed 11 years ago.

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 --

开发者_如何学Python

static 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜