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 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.
-配列は格納されているオブジェクトHeap
ですが、Java 6u23
バージョンからEscape Analysis
、JVMがオブジェクトがメソッドをエスケープできないと判断した場合、スレッドにオブジェクトを作成しようとします。スタック、ヒープ上ではありません...。