0

Why does this code not run (for hidden case 3 it shows cross)

import java.util.Scanner; import java.lang.Math ; abstract class Shape { int width; abstract void area(); } //your code goes here class Circle extends Shape { Circle(int a){ width = a; } void area (){ System.out.println( width * width * Math.PI ); } } class Square extends Shape { Square (int a){ width = a ; } void area (){ System.out.println( width * width ); } } 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(); } }

20th Dec 2020, 4:50 PM
Shubham Bawner
Shubham Bawner - avatar
1 ответ
20th Dec 2020, 5:03 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar