Question: Please refer to the code in the Appendix (pages 3 - 4) to answer the following questions. 1. Write the output for each section of
Please refer to the code in the Appendix (pages 3 - 4) to answer the following questions. 1. Write the output for each section of print statements. (10 points)
2. Which Rectangle constructor does instance box1 call? Why? What concept does this demonstrate? Explain [in four sentences or less].(10 points)
3. Which Rectangle constructor does instance box2 call? Why? What concept does this demonstrate? Explain [in four sentences or less]. (10 points)
4. Which Rectangle constructor does instance box3 call? Why? What concept does this demonstrate? Explain [in four sentences or less]. (10 points)
5. What is the connection between box2 and box4? What happens (memory wise) when both box2 and box 4 are declared null? Explain [in three sentences or less]. (20 points)
6. In the Main class, there are two variables named z. What is the difference between the two variables? What concept does the output of the last three print statements demonstrate? Explain [in four sentences or less]. (20 points)
7. In the Rectangle class, explain the implementation of the Rectangle(int l, int w) constructor. Explain [in four sentences or less]. (10 points)
8. In the Rectangle class, explain the implementation of the Rectangle(Rectangle other) constructor. Explain [in four sentences or less]. (10 points)
APPENDIX Main.java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
