Hallo zusammen, ich habe leider keine Ahnung wo mein Fehler liegt. Kann mir bitte jemand einen Denkanstoß geben weil ich glaube ich habe mich total fest gefahren.
Vielen Dank schon mal im voraus.
package de.codegym.task.task02.task0217;
/*
Die kleinste aus vier Zahlen
*/
public class Solution {
public static int min(int a, int b, int c, int d) {
//schreib hier deinen Code
int min = 0;
if (min(a,b)<=c && min(a,b)<=d)
min = a;
else if (a<=b && b<=c && b<=d)
min = b;
else if (c<=min(a,b) && c<=d)
min = c;
else
min = d;
return min;
}
public static int min(int a, int b) {
//schreib hier deinen Code
int kleinste = 0;
if(a<b)
kleinste = a;
else
kleinste = b;
return kleinste;
}
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));
}
}