QUESTION #2 (SELF-CHECK)
SOLUTIONS
a) What
will the array look like in memory after the following statement?
Point[] pts = new Point[6];
Solution:
b) What
will the array look like in memory after the following statement?
Point[] pts = {new
Point(7,3), new Point(0,4), new
Point(1,2)};
Solution:
c) What will the array look like in memory after the following statements?
Point[] pts = new
Point[4];
pts[2] =
new Point(7,5);
Solution:
d) Write the statement(s) required to create the following Point array in
memory.
Solution:
Point[] data = new Point[8];
pts[3] = new Point(7, 2);
pts[5] = new Point(1, -2);
pts[6] = new Point(3, 4);
|