vendredi 8 septembre 2017

Can anybody help me with this output , because i dont understand it , its 30 . and im a beginner in Java

When I compile the output is 30 . I thought it would be 2 beacause z is smaller than 0 so z = z + 3 , (-1 + 3 = 2):(. I dont get it

    int z = -1;

    if(z < 0)
        z += 3;
    else if(z == 2)
        z += 5;
    if(z < 5)
        z *= 15;
    System.out.println("z is  = " + z);

Aucun commentaire:

Enregistrer un commentaire