samedi 26 mars 2016

No curly braces if else statements?

int x = 5, y = 5, z = 5;
  if ( x != 5 )
    if ( y <= 7 )
    z = z + 4;
  else
    z = z + 2;
 System.out.println( z ); 

Will the "else" runs? Which "if" does it belong to? Why or why not? Thanks

Aucun commentaire:

Enregistrer un commentaire