So I want to make an if statement like this:
int variable;
if (variable != 1 || variable != -1 || variable != 0) {
System.out.println("message");
}
So it should NOT output the message when the variable equals 1, -1 or 0... however it doesnt do that. When variable = 1, variable = -1 or variable = 0it still outputs message as well when it actually meets the condition eg. variable = 2.
Where am I going wrong?
Aucun commentaire:
Enregistrer un commentaire