如何对对象判断
我写了一个宿舍成员的类,然后我再写一个测试类,在测试类中实例化很多对象,然后判断身高高于某个值的对象的全部信息输出来,如何办到。//宿舍成员类
public class Sushecy {
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public double getShengao() {
return shengao;
}
public void setShengao(double shengao) {
this.shengao = shengao;
}
public String getHobbit() {
return hobbit;
}
public void setHobbit(String hobbit) {
this.hobbit = hobbit;
}
private String name;
private int age;
private double shengao;
private String hobbit;
public Sushecy(String dname,int dage,double dshengao,String dhobbit){
name=dname;
age=dage;
shengao=dshengao;
hobbit=dhobbit;
}
//测试类
public class test {
public static void main(String args[]){
Sushecy lyw=new Sushecy("罗**",23,162.5,"旅游");
Sushecy mzm=new Sushecy("麦**",23,172.0,"篮球");
Sushecy……
……
……
……
}
}