Выдает "Неизвестная ошибка компиляции в строке 10".
Пробовал не назначать переменную g со ссылкой на метод min(int a, int b), а просто вставлять его название в уравнение - все равно не проходит.
Код
Public class Solution {
public static int min(int a, int b, int c, int d) {
//напишите тут ваш код
int f;
int g = min(int a, int b)
if g <= c && g <= d)
f = g;
else
if (c <= g && c<= d)
f = c;
else f = d;
return f;
}
public static int min(int a, int b) {
//напишите тут ваш код
int e;
if (a < b)
e = a;
else e = b;
return e;
}
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));
}
}
package com.javarush.task.task02.task0217;
/*
Минимум четырех чисел
*/
public class Solution {
public static int min(int a, int b, int c, int d) {
//напишите тут ваш код
int f;
int g = min(int a, int b)
if g <= c && g <= d)
f = g;
else
if (c <= g && c<= d)
f = c;
else f = d;
return f;
}
public static int min(int a, int b) {
//напишите тут ваш код
int e;
if (a < b)
e = a;
else e = b;
return e;
}
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));
}
}