[Solved] Return something in a java method in a if condition


All possible code paths must return a value. In this case, if none of those if conditions are satisfied, nothing is being returned. You must have a final else that returns something.

public static char Feld(){
    if (vertical == 1 && horizontal == 1) {
        return Feld11 = Player1;
    } else if (vertical == 1 && horizontal == 2) {
        return Feld12 = Player1;
    } else if (vertical == 1 && horizontal == 3) {
        return Feld13 = Player1;
    } else {
        return Feld00 = Player1;
    }
}

1

solved Return something in a java method in a if condition