很长时间没有来这里写博客了,应该写一下
public class test {
private String name;
private int hao;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getHao() {
return hao;
}
public void setHao(int hao) {
this.hao = hao;
}
public String toString() {
return "test [name=" + name + ", hao=" + hao + "]";
}
public static void main(String[] args) {
test st=new test();
st.setHao(234);
st.setName("sdfs");
System.out.println(st);
}
}
java可以自动生成get方法和set方法还可以重写toString方便输出