+ 1
Tried to solve the test for abstract classes in Java course. My Code fails in hidden test case #3 and i dont know why.
2 Réponses
+ 1
your are not using the abstraction concept, normally you should extend the classes.
class Square extends Shape{....}
class Circle extends Shape {....}
your code works without that tho.
the issue is in
double result= this.width*this.width * Math.PI;
changing the order of the variables to
double result= Math.PI * this.width*this.width;
works, I don't know how is it even relevant.
+ 1
Damn shoud've seen that. Added "extends Shape " changed the order, Codes works totally fine. Thank you.