Determine if one value is less than another with the < operator.
public static boolean compare(int val1, int val2) {
boolean result = val1 < val2;
return result;
}
Function Call | Return Value | |||
---|---|---|---|---|
compare(4, 6) | → | |||
compare(8, 12) | → | |||
compare(19, 19) | → | |||
compare(12, 8) | → | |||
compare(11, 28) | → |
Experiment with this code on Gitpod.io