I am doing some studying and I came across a question that asks to show the correct memory diagram of the following code:
int [] d1 = new int[5];
d1[0] = 3;
Integer [] d2 = new Integer[5];
d2[0] = new Integer(3);
ArrayList d3 = new ArrayList();
d3.add(3);
Here is my attempt at a memory diagram, but it may be incorrect:
I understand things like objects, instance variables, and "new" instances are all on the heap and things such as local variables and primitive types are on the stack, but I'm still confused when it comes to array types.
Any help is appreciated.