X23: closeFar

Write a function in Java that implements the following logic: Given three ints, a, b, and c, return true if one of b or c is "close" to a (differing from a by at most 1), while the other is "far" from a, differing from both other values by 2 or more. Note: Math.abs(num) computes the absolute value of a number.

Reset

Practice a different Java exercise