vendredi 22 novembre 2019

2 if statements back to back

int x = 9; int y = 8; int z = 7;

    if(x>9)
    if(y>8)
       System.out.println("x>9 and y>8");
    else if(z>=7)
       System.out.println("x<=9 and z>=7");
    else
      System.out.println("x<=9 and z<7");

Firstly, I look first if statement and it is not possible. that's why i am continuing and look the other if which is again not possible and now going to else if and it is possible. that's why i thought output would be ("x<=9 and z>=7")

however, nothing appears. what am i missing?

Aucun commentaire:

Enregistrer un commentaire