jeudi 22 juin 2017

Java if statement with ++ [duplicate]

This question already has an answer here:

Excuse me if this is a stupid question. I understand the statement but do not know how it exactly works for each variable. How come y values below stays the same?

public boolean function(){
    int x = 1;
    int y = 2;
    if (x ==1|| ++y >= 2){

    }
    System.out.println(y);
}

Aucun commentaire:

Enregistrer un commentaire