我正在尝试将两个 int 值与一种方法进行比较。
我将两个 get 方法放在一起,因为 array[i] 是一个人员对象列表,而 gethouse 只给出了 house 对象,而 houseid 在另一个类中。
我想知道是否可以依次设置两个 get() 方法?
public Person findperson( int houseId ){
for ( int i = 0; i < array.length; i++ ){
if ( array[ i ].gethouse().gethouseID() == houseId ){
return array[ i ];
}
}
return null;
}