}
}
public double area(){ }
return 3.14*r*r;
class RectArea extends Area{ }
class ImpleArea{ }
static double a,b; static void test(){ }
Scanner sc = new Scanner(System.in); System.out.println(\请输入半径:\);
RoundArea A = new RoundArea(sc.nextDouble()); System.out.println(\请输入宽:\); a=sc.nextDouble();
System.out.println(\请输入高:\); b=sc.nextDouble();
RectArea B = new RectArea(a,b); sc.close();
System.out.println(A.area()); System.out.println(B.area()); double a,b;
RectArea(double a,double b){ }
public double area(){ }
return a*b; this.a=a; this.b=b;
5. 编写一个Flyable接口,包含:
方法:double flySpeed(),用于返回最大的飞行速度。并实现该接口.
public class Main {
4
}
public static void main(String args[]){ }
A fly = new A();
System.out.println(fly.flyspeed());
interface Flyable{ }
class A implements Flyable{ }
public double flyspeed(){ double speed = 0; /*
* 计算过程 */
return speed; }
public double flyspeed();
5