25 lines
449 B
Java
25 lines
449 B
Java
|
package exp3;
|
||
|
|
||
|
public class Cat extends Animal {
|
||
|
//成员属性
|
||
|
String breed;
|
||
|
|
||
|
//无参构造
|
||
|
public Cat(){
|
||
|
super();
|
||
|
this.breed = "橘猫";
|
||
|
}
|
||
|
|
||
|
//全参构造
|
||
|
public Cat(String name, int weight, String color, String breed){
|
||
|
super(name, weight, color);
|
||
|
this.breed = breed;
|
||
|
}
|
||
|
|
||
|
//行为-喵喵叫
|
||
|
public void miaow(){
|
||
|
System.out.println(this.name+"在喵喵叫");
|
||
|
}
|
||
|
|
||
|
}
|