CoreJava/exp3/Dog.java
2024-05-09 09:10:51 +08:00

25 lines
444 B
Java

package exp3;
public class Dog extends Animal {
//成员属性
String breed;
//无参构造
public Dog(){
super();
this.breed = "中华田园犬";
}
//全参构造
public Dog(String name, int weight, String color, String breed){
super(name, weight, color);
this.breed = breed;
}
//行为-吠叫
void bark(){
System.out.println(this.name+"在吠叫");
}
}