lundi 2 octobre 2017

The operator ! is undefined for the argument type(s) int

I know I cannot compare an int to a Boolean although I don't know what else I could do to anticipate the situation in which no argument is given

public void setNum(int newNum) {

    if(!newNum) {
        num = 0;
    }
    num = newNum;

}

Aucun commentaire:

Enregistrer un commentaire