25 lines
446 B
Java
25 lines
446 B
Java
// control/IfElse2.java
|
|
// ©2015 MindView LLC: see Copyright.txt
|
|
import static com.mindviewinc.util.Print.*;
|
|
|
|
public class IfElse2 {
|
|
static int test(int testval, int target) {
|
|
if(testval > target)
|
|
return +1;
|
|
else if(testval < target)
|
|
return -1;
|
|
else
|
|
return 0; // Match
|
|
}
|
|
public static void main(String[] args) {
|
|
print(test(10, 5));
|
|
print(test(5, 10));
|
|
print(test(5, 5));
|
|
}
|
|
}
|
|
/* Output:
|
|
1
|
|
-1
|
|
0
|
|
*/
|