我不明白为什么我的编译器找不到类,考虑到我不是已经在我的方法中做到了吗?编译器指向以下行:Weightpublic boolean checkWeight
`Weight first = new Weight();`
和
`Weight second = new Weight();`
public class Guard {
int stashWeight;
public Guard ( int maxWeight ) {
this.stashWeight = maxWeight;
}
public boolean checkWeight (Weight maxWeight) {
if ( maxWeight.weight >= stashWeight ) {
return true;
} else {
return false;
}
}
public static void main (String[] args ) {
Weight first = new Weight();
first.weight = 3000;
Weight second = new Weight();
second.weight = 120;
Guard grams = new Guard(450);
System.out.println("Officer, can I come in?");
boolean canFirstManGo = grams.checkWeight(first);
System.out.println(canFirstManGo);
System.out.println();
System.out.println("Officer, how about me?");
boolean canSecondManGo = grams.checkWeight(second);
System.out.println(canSecondManGo);
}
}
Qyouu
慕娘9325324
守候你守候我
翻过高山走不出你
随时随地看视频慕课网APP
相关分类