jeudi 25 avril 2019

Why is else if condition false?

Can you please tell why is else if block not executed even if it is true?

    int age = 24;

    if (age > 22) {
        System.out.println("if executed");
    } else if (age > 20) {
        System.out.println("else if executed");
    }

Output:

if executed

Aucun commentaire:

Enregistrer un commentaire