public class finalExercise {
public static void main(String[] args) {
System.out.println(new Circle(5.0).area());
}
}
class Circle{
private double ridus;
private final double PI;
public Circle(double ridus) {
this.ridus = ridus;
// PI = 3.14
}
{
PI = 3.14;
}
public double area(){
return ridus * ridus * PI;
}
@Override
public String toString() {
return "Circle{" +
"ridus=" + ridus +
", PI=" + PI +
'}';
}
}