求java编程!!!在线等 急!!!!

2025-01-05 06:14:40
推荐回答(1个)
回答1:

package sss;

public class A {
protected static final float myPI=(float) 3.1416;
public final float m1(float r){
return 2*myPI*r;
}
}

package sss;

public final class B extends A {

public void m2(float r){
System.out.println("圆的周长 为:"+m1(r));
float area=myPI*r*r;
System.out.println("圆的面积 为:"+area);
}
public static void main(String[] args) {
new B().m2(5);
}
}

刚好无聊给你随便写下吧!!!