我正在嘗試將三個長度與0進行比較,並且想知道是否有比重複“!= 0”更有效/更清潔的方法.
public static boolean isTriangle(int lengthA, int lengthB, int lengthC) {
if (lengthA != 0 && lengthB != 0 && lengthC != 0) { //is there a shorter/cleaner way to write this?
//do a thing
}
return false;
}