CS 1713 Introduction to Computer Science Example Problem

Name:

Consider the Rectangle class that we developed and assume we have the following:

   Rectangle r1 = new Rectangle(3,4);
   Rectangle r2 = new Rectangle(5,6);
   Rectangle r3 = r1;
   System.out.println("r1 has width "+r1.getWidth());
   System.out.println("r2 has width "+r2.getWidth());
   System.out.println("r3 has width "+r3.getWidth());
   r1.setWidth(17);
   System.out.println("r1 has width "+r1.getWidth());
   System.out.println("r3 has width "+r3.getWidth());
   r1 = r2;
   System.out.println("r1 has width "+r1.getWidth());
   System.out.println("r3 has width "+r3.getWidth());
Draw an accurate schematic of the program variables after the code segment is executed.
What is the output generated?