public interface PetOutput{
void sound();
}
public class Dog implements PetOutput{
private String name;
private String breed;
public Dog (String aName){
name=aName;
breed="哈巴犬";
}
public Dog (String aName, String aBreed){
name=aName;
breed=aBreed;
}
public void training(){
System.out.println("汪汪汪汪汪......");
}
public String toString(){
return"它的名字"+name+",它是"+breed;
}
}
来源:https://www.cnblogs.com/l2760186162/p/10752738.html