package com.hanqi.test; public class Animal {
private String name;
private int legs;
private int count;
public String getKind() {
return name;
}
public void setKind(String name) {
this.name = name;
}
public int getLegs() {
return legs;
}
public void setLegs(int legs) {
this.legs = legs;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}
package com.hanqi.test; public class Fish extends Animal { }
package com.hanqi.test; public class Tiger extends Animal { }
package com.hanqi.test; public class SouthEastTiger extends Tiger { }
package com.hanqi.test; public class Test02 { public static void main(String[] args) {
Rect re=new Rect();
re.setA();
re.setB();
re.getArea(); Circle cc=new Circle(); System.out.println("radius=30圆 的面积是:"+cc.getArea()); SouthEastTiger set= new SouthEastTiger();
set.setCount();
System.out.println("SouthEastTiger的数量是:"+set.getCount());
Tiger t=new Tiger();
t.setCount();
System.out.println("tiger的数量是:"+t.getCount()); } }