How much memory space will be created by the sentence var a = new Object ();?

I think there are three, as shown in the following picture, is it like this?

1. Variable name a, the address to store the variable value a
2. Variable value a, the address of the storage object
3. The address of the object, which is stored

Mar.17,2021

there should be only two. The object is on the heap and the address is on the stack. The variable name actually belongs to the code and should exist in the code segment, not the data segment

.
Menu