Question
Here is a program that assumes the Shape interface and the Triangle class of question 2 have been coded and are available. In addition, other
Here is a program that assumes the Shape interface and the Triangle class of question 2 have been coded and are available. In addition, other classes have been written as well. EquilateralTriangle extends Triangle , and Rectangle implements Shape . EquilateralTriangle does not override the m ethods numSides and perimeter. class ShapeApp { public static void main(String [] args) { Shape [] shapes = new Shape[3]; shapes[0] = new EquilateralTriangle(3); shapes[1] = new RightTriangle(3, 4); shapes[2] = new Rectangle(3, 4); for (int i = 0; i < shapes.length; i++) { System.out.println(shapes[i].numSides()); System.out.println(shapes[i].perimeter()); } } } When i gets the values of 0, 1, and 2, which exact methods are called in the for loop?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started