Which class method will be called under lines //Line 1 and //Line 2 in the following
code? class Rectangle { double width, length; Rectangle(double width, double length) {
this.width = width; this.length = length; } double getArea() { double area = width * length;
return area; } void show() { System.out.println(""The width and length are: "" + width + "",
"" + length); System.out.println(""The area is: "" + getArea()); } } class Square extends
Rectangle { double width, length; Square(double width) { super(width, width); this.width
= width; } double getArea() { double area = width * width; return area; } void show() {
System.out.println(""The width is: "" + width); System.out.println(""The area is: "" +
getArea()); } public static void main(String[] args) { Rectangle shape1 = new
Rectangle(5, 2); Square shape2 = new Square(5); shape1.show(); // Line 1
shape2.show(); // Line 2 } }
Answer
Correct Answer: shape1.show(); // Line 1 - Square Class Method Call shape2.show(); // Line 2 -Square Class Method Call
Explanation:
Note: This Question is unanswered, help us to find answer for this one