Подскажите, что не так в коде, почитав обсуждения этой задачи,конечно можно было попробовать другое решение из предложенных,но хотелось бы понять, что неверно здесь?
package com.javarush.task.task02.task0217;
/*
Минимум четырех чисел
*/
public class Solution {
public static int min(int a, int b, int c, int d) {
min(a, b);
if (min(a, b)<=c)
return a;
else
return с;
if (min(a, b)<=d)
return a;
else
return d;
if (с<=d)
return c;
else
return d;
}
public static int min(int a, int b) {
if (a<=b)
return a;
else
return b;
}
public static void main(String[] args) throws Exception {
System.out.println(min(-20, -10));
System.out.println(min(-40, -10, -30, 40));
System.out.println(min(-20, -40, -30, 40));
System.out.println(min(-20, -10, -40, 40));
System.out.println(min(-20, -10, -30, -40));
}
}