class Dog{
private String name,color;
private int age;
public Dog(String name,String color,int age){
this.name=name;
this.color=color;
this.age=age;
}
public void print(){
System.out.println("名字:"+name+" 颜色:"+color+" 年龄:"+age+"岁");
}
}
public class DogTest{
public static void main(String args[]){
Dog d=new Dog("哈士奇","白色",5);
d.print();
}
}
版权声明:本文为weixin_42895133原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。