要求写一个狗类,至少要有5个属性。急!网上找了好久好像复制了都会有错误是为什么求解。
这个比较简单,网上找不到吧。
我自己打好多错误,不知道为什么
不可能吧,估计是你的jdk环境没有设置好
public class Dog {
private Integer age;
private String weight;
private String height;
private String color;
private String sex;
public Dog() {
}
public Dog(Integer age, String weight, String height, String color, String sex) {
this.age = age;
this.weight = weight;
this.height = height;
this.color = color;
this.sex = sex;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public String getWeight() {
return weight;
}
public void setWeight(String weight) {
this.weight = weight;
}
public String getHeight() {
return height;
}
public void setHeight(String height) {
this.height = height;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
}
贴一下你的错误代码.