Where does the static variable reside
-静态变量位于 中Method Area
,而 permgen 位于 Method 区域内。
Where does the final variable reside and what is its life if
Its an instance variable of type primitive
-如果它的实例变量,它停留在Heap inside the Object
它所属的对象上,并且由于没有对持有它的对象的引用而超出范围。
Its a local variable of a method of type primitive
-它停留在堆栈上,并且在到达方法右括号时超出范围......
Its an instance variable of type reference
-它停留在Heap inside the Object
它所属的对象上,并且超出范围,因为没有对持有它的对象的引用。
Its a local variable of a method of type reference
-它停留在堆栈上,并且在到达方法右括号时超出范围......
Where are the reference local variables stored if they are local.
-在堆栈上...
In case of arrays is there any difference in memory allocation as in they are instance
variable or local thread variable.
- Array是一个存储它的对象Heap
....但是从Java 6u23
版本开始,已经引入Escape Analysis
了堆栈,而不是堆......