求救:菜鸟新问题,代码不能运行?
public class ifElse {
static int test(int testval, int target) {
int result = 0;
if(testval > target)
result = -1;
else if(testval < target)
result = 1;
else
return result;
}
public static void main(String [] args) {
System.out.println(test(5, 10));
System.out.println(test(5, 10));
System.out.println(test(5, 5));
}
}