0

Why this can't running ?

Class Circle { private int radius; public void setRadius(int radius) { this.radius = radius; } public double area() { return this.radius * this.radius * Math.PI; } } public class Methods { public static void main(String[] args) { Circle c = new Circle(); c.setRadius(5); System.out.println(c.area()); } }

18th Nov 2017, 8:34 AM
Fachrurrozi
Fachrurrozi - avatar
1 Answer
+ 7
class should be spelled with small c. Change "Class Circle" to "class Circle".
18th Nov 2017, 8:59 AM
Shamima Yasmin
Shamima Yasmin - avatar