Closed LeeHanYongAndy closed 3 years ago
I believe we have to use "implements" if we are accessing an interface method and use "extends" to access a class. So since Circle is a class, extends should be used here. Not sure tho.
I believe we have to use "implements" if we are accessing an interface method and use "extends" to access a class. So since Circle is a class, extends should be used here. Not sure tho.
Yes, I have googled it as well. You're absolutely correct on using "implements" for interfaces. Similarly, I believe that it should be "extends" since it's referring to a superclass but I'm lost too haha.
This is an oversight on my part. I did not remove the implements
from the template.
For this one,
implements
, please make Shape
an interface
(Interfaces are covered in Week 5 material).implements
to extends
and make Shape
a class
.in both cases, the polymorphic behavior of the area method is apparent.
This is an oversight on my part. I did not remove the
implements
from the template.For this one,
- If you wish to continue with
implements
, please makeShape
aninterface
(Interfaces are covered in Week 5 material).- If not, you can change
implements
toextends
and makeShape
aclass
.in both cases, the polymorphic behavior of the area method is apparent.
Hi Professor, Understood. Thank you for the clarification! 👍🏼
Can I clarify if this is intended?
In Circle.Java and Rectangle.Java, line 1 was written as "public class Circle implements Shape{" and "public class Rectangle implements Shape{".
Was the use of "implements" intended as I could not get my program to produce the expected output unless I change the implement to extends.