发布网友 发布时间:2022-04-30 21:21
共2个回答
热心网友 时间:2023-06-13 01:30
灞曞紑鍏ㄩ儴public class Circle {
热心网友 时间:2023-06-13 01:30
灞曞紑鍏ㄩ儴package test02;public class Circle {private static final double PI = 3.1415926535;private double Radius;//鍦嗙殑鍗婂緞public Circle(){this(0);}public Circle(double r){Radius = r;}public double getArea(){return PI*Radius*Radius;}public double getPerimeter(){return 2*PI*Radius;}public void show(){System.out.println("鍦嗙殑鍗婂緞涓?quot;+Radius+",鍛ㄩ暱涓?quot;+getPerimeter()+",闈㈢Н涓?quot;+getArea());}public static void main(String[] args) {Circle c = new Circle(2);c.show();}}