java为什么这个条件语句不编译?
对于CodingBat练习,我必须看看两个int值中哪一个最接近10,但它总是给我一个错误,我不确定为什么
我得到的错误是:
The method
abs(int)
in the classMath
is not applicable for the arguments (boolean
)
public int close10(int a, int b) {
int m;
if (Math.abs(a - 10 > b - 10)) // here is the error
m = b;
else
m = a;
return m;
}
共 (0) 个答案