Starting from:
$26.99

$20.99

Exam 1 Review Problems Solution

Suppose we have a class A which has a constructor that takes a single integer.
(a) After the following statements have been executed, how many A objects will exist
(not counting garbage objects) and which objects are they? Explain your answer
and include in your explanation a picture of Java’s memory.
A a = new A(100);
A b = new A(150);
A c = b;
b = a;
a = null;
(b) After the following statements have been executed, how many A objects will exist
(not counting garbage objects) and which objects are they? Explain your answer
and include in your explanation a picture of Java’s memory.
A a1 = new A(200);
A a2 = new A(250);
A a3 = a2;
a2 = a1;
a1 = null;


2

Consider this code that creates some Location objects Location a, b, c; a = new Location(10,20); b = new Location (10,20); After this code executes, what are the values of these boolean expressions? a=-b a.equals (b) a--c a.equals(c) b.equals (c)

More products