mardi 25 mai 2021

else if and equals is always false

i have a code like this :

        if (a.equals("ay") || a.equals("ya") && b.equals("1")) {
        Res = "hase";
    } else if (a.equals("ay") || a.equals("ya") && b.equals("2")) {
        Res = "ains";
    } else if (a.equals("ay") || a.equals("ya") && b.equals("3")) {
        Res = "gha";
    }

but it doesn't work true. after line one other equals in other ElseIf is always false.

Aucun commentaire:

Enregistrer un commentaire