Help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Help

When I running they tell me try again import java.util.Scanner; abstract class Shape { int width; abstract void area(); } //your code goes here public class Square extends Shape { int width ; public Square (int width ){ this.width =width; } public void area(){ int area = width * width ; System.out.println(area ); } } public class Circle extends Shape { int width ; public Circle (int width ){ this.width =width ; } public void area(){ double area= Math.PI*width*width; System.out.println( area); } } public class Program { public static void main(String[ ] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); Square a = new Square(x); Circle b = new Circle(y); a.area(); b.area(); } }

19th Apr 2021, 3:27 PM
hossin Chorfi
hossin Chorfi - avatar
3 Answers
+ 2
It is working fine with no syntax errors
19th Apr 2021, 6:03 PM
Atul [Inactive]
0
Check your internet connection or after some time run it again. Sololearn have this sort of issues
19th Apr 2021, 4:32 PM
Atul [Inactive]
0
The cod is wrong or not
19th Apr 2021, 5:45 PM
hossin Chorfi
hossin Chorfi - avatar