0
Why is it wrong?
1 Answer
+ 3
First, your implementations must be different, the calculation for the circle is wrong.
Then remove these lines:
Area = area;
area = rect;
area = cir;
And get directly your variables rect and circ in the println.
Good practice : we often try to instantiate the object by declaring the most abstract parent :
Area cir = new Circle()
Area rect = new Rectangle()
It allows to have for example a list of Areas or a method waiting for an Area whatever the implementation