If I have a function that in that function I declare:
Object arr[] = new Object[20];
Where are arr and the whole array stored? heap? stack? Does it matter if the declaration is in some function or in main()?
and let's say I also have these command lines:
arr[0] = new String("abc");
arr[1] = new List();
where are arr[0]
and arr[1]
stored?
Memory diagram:
Boxes are memory locations (where binary numbers can be stored).
Arrows are memory references (i.e. pointers).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With