So recently I got a question that how to perform the function of if...else without if...else.
Like if a program is to find the greater between integer a and b, one would easily write that
if (a>b) {
System.out.println("a is greater");
} else {
System.out.println("b is greater");
}
Is there any other way to do this without if...else method?
System.out.printf("%d is greater than %d%n", Math.max(a, b), Math.min(a, b));