Integer  myarray = new Integer; for (int i = 0; i < 1000; i++) myarray[i] = new Integer(i);About how many bytes are used by (a) the variable myarray, (b) what it points to, and (c) the total storage allocated by this code?
The variable myarray is a reference variable, so it has the pointer size, 8 bytes.
The array is an array of pointers, so it is about 8000 bytes.
The pointers point to individual Integer objects, each of size 16 bytes, so these occupy 16000 bytes.
Page-10 Prev Next Page+10