Multiple Choice
Consider the following class definition. public class Rectangle {private double length; private double width; public Rectangle() {length = 0; width = 0;} public Rectangle(double l, double w) {length = l; width = w;} public void set(double l, double w) {length = l; width = w;} public void print() {System.out.println(length + " " + width) ;} public double area() {return length * width;} public double perimeter() {return 2 * length + 2 * width;}} Which of the following statements correctly instantiates the Rectangle object myRectangle? (i) myRectangle = new Rectangle(12.5, 6) ; (ii) Rectangle myRectangle = new Rectangle(12.5, 6) ; (iii) class Rectangle myRectangle = new Rectangle(12.5, 6) ;
A) Only (i)
B) Only (ii)
C) Only (iii)
D) Both (ii) and (iii)
Correct Answer:

Verified
Correct Answer:
Verified
Q34: In shallow copying, each reference variable refers
Q35: The components of a class are called
Q36: A class and its members can be
Q37: How many finalizers can a class have?<br>A)
Q38: Every object has access to a reference
Q40: The method finalize automatically executes when the
Q41: Based on the class in the accompanying
Q42: <img src="https://d2lvgg3v3hfg70.cloudfront.net/TB8472/.jpg" alt=" -According to the
Q43: In Java, the reference this is used
Q44: <img src="https://d2lvgg3v3hfg70.cloudfront.net/TB8472/.jpg" alt=" -According to the