问题描述
这是checkstyle不喜欢的部分,特别是“ if(egs> = 3)”行。如何更改它以使其通过Checkstyle?
if (flour >= 1)
{
if (sugar >= 2)
{
if (eggs >= 3)
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
解决方法
public static boolean foo(int flour,int sugar,int eggs) {
return flour >=1 && sugar >= 2 && eggs >=3;
}