int  myarray = new int;About how many bytes are used by (a) the variable myarray, and (b) what it points to?
myarray is a reference variable, so it contains only a pointer to the actual value. Pointers are 8 bytes on a more modern machine.
Each int is 4 bytes; since there are 1000 of them, the total is 4000 bytes. There is some additional storage in the array for storing the Array class designation, .length, and hash code; this is small compared to the bulk of the array.
Prev Next Page+10