, - if else ( ). switch , . , , , . , , -
public Boolean inRange(int num, int lowBound, int topBound)
{
return (num > lowBound && num < topBound);
}
,
else if (a==2 && b.equalsIgnoreCase("line")
&& inBound(c, 1, 8) && d)
This does not look too confusing and will work (you will need to decide whether it is inclusive or exclusive restrictions included).
The reason for the modified method is that it can be used elsewhere, which makes it useful for checking the range.
source
share