mardi 30 octobre 2018

What does a chained if construct do in Java?

From reading through the Oracle iLearning Java course, I am under the impression that using a 'chained if construct' is the equivalent of using the '&&' operator. So:

 if((5 < 10) && (5 < 6)) {
    run some code;
}

is the same as:

if(5 < 10) {
  if(5 < 6) {
        run some code;
    }
}

comparing the two, I find it hard to believe. I think I am very misunderstood.

Aucun commentaire:

Enregistrer un commentaire