package 定义接口;public interface IGame{
float PI = 3.14F;
float zhouchang();
float mianji();
}
class changfangxing implements IGame{
private int chang;
private int kuan;
public changfangxing(int chang,int kuan) {
this.chang = chang;
this.kuan = kuan;
}
public float zhouchang() {
return (chang+kuan)*2;
}
public float mianji() {
return chang*kuan;
}
}
class ceshi{
public static void main(String args[]) {
IGame ig = new changfangxing(8,5);
System.out.println(ig.zhouchang());
System.out.println(ig.mianji());
}
}