I have the right answer got. But i dont understand why i get these Problem ?
public class Solution {
public static int min(int a, int b, int c, int d) {
//write your code here
int min;
if (a<=b && a<=c && a<=d)
min = a;
else if (d<=a && d<=b && d<=c)
min = d;
else if (c<=a && c<=b && c<=d)
min = c;
else
min = b;
return min;
}
public static int min(int a, int b) {
//write your code here
int min;
if (a<=b)
min = a;
else
min = b;
return min;
}
public static void main(String[] args) throws Exception {
System.out.println(min(-20, -10));
System.out.println(min(-20, -10, -30, -40));
System.out.println(min(-20, -10, -30, 40));
System.out.println(min(-40, -10, -30, 40));
}
}
![]()
