Consider the following statements.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 = " + length + "; Width = " + width + "\n" + + " Area = " + area() + "; Perimeter = " + perimeter()); } public double area() { return length * width;
} public void perimeter() { return 2 * length + 2 * width; } public void makeCopy(Rectangle otherRect) { length = otherRect.length; width = otherRect.width }}
Rectangle tempRect = new Rectangle(14, 10);Rectangle newRect = new Rectangle(9, 5);What are the values of the instance variables of newRect after the following statement execute?newRect.makeCopy(tempRect);
A. length = 14; width = 10
B. length = 9; width = 5
C. length = 14; width = 5
D. None of these
Answer: A
You might also like to view...
In a broadband LAN, carrier frequencies are used to modulate the signals on different channels.
a. True b. False
____________________ is the protection of information and its critical elements, including the systems and hardware that use, store, and transmit that information.
Fill in the blank(s) with the appropriate word(s).
In BNF, the ____ is used to separate two alternative definitions of a nonterminal.
A. forward slash B. vertical bar C. backward slash D. asterisk
Which of the following is not a commonly used property of a text box?
A. BackColor B. Multiline C. ScrollBars D. Description