class demo_ju {
public static void main(String[] args) {
Cfx a = new Cfx(4,7);
a.zhou();
a.mian();
}
}
class Cfx {
private int chang;
private int kuan;
public Cfx () {}
public Cfx (int chang,int kuan) {
this.chang = chang;
this.kuan = kuan;
}
public void setChang(int chang) {
this.chang = chang;
}
public int getChang() {
return chang;
}
public void setKuan(int kuan) {
this.kuan = kuan;
}
public int getKuan() {
return kuan;
}
public void zhou() {
System.out.println("周长是 :" + (chang + kuan) * 2);
}
public void mian() {
System.out.println("面积是:" + chang * kuan);
}
}
|
|