Where does the static variable reside
-靜態變量駐留在Method Area
,和PermGen的是方法區域內。
Where does the final variable reside and what is its life if
Its an instance variable of type primitive
-如果其實例變量,它停留在Heap inside the Object
其所屬和超出範圍,因爲是將其保持它的對象沒有提到..
-它停留在堆棧,並超出範圍,因爲截至收盤達到方法撐...
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.
-好視數組是存儲在Heap
對象 ....但是從Java 6u23
版本,一直存在引入Escape Analysis
,根據這個如果JVM認定該對象不能逃避該方法,它會嘗試在線程堆棧上創建對象,而不是在堆上....
對於4個不同的問題,4個不同的線程如何? – CodeBlue