class Maths{ double r; double girth; double area; final double PI=3.14; public void setR(double r) { this.r=r; } public double getR() { return r; } public void girth() { girth=2*PI*r; System.out.println("这个圆的周长是:"+girth); } public void area() { area=PI*r*r; System.out.println("这个圆的面积是:"+area); } } public class Main { public static void main(String[] args){ Maths maths=new Maths(); maths.setR(5.66); maths.girth(); maths.area(); } }