Question: Can you help me solve this? This exercise is about aliasing. Recall that aliases are two variables that refer to the same object. The following
Can you help me solve this?
This exercise is about aliasing. Recall that aliases are two variables that refer to the same object. The following code uses findCenter and printPoint as dened in this chapter.
1. Draw a diagram that shows the state of the program just before the end of main. Include all local variables and the objects they refer to.
public static void main(String[] args) { Rectangle box1 = new Rectangle(2, 4, 7, 9); Point p1 = findCenter(box1); printPoint(p1); box1.grow(1, 1); Point p2 = findCenter(box1); printPoint(p2); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
