mercredi 23 mars 2016

Correct way to use multiple conditions in If statement?

In my code I want to check if the status of a Dog object is not that of 3 Enums:

if((dogList.get(i).getStatus()!= dogStatus.SLEEPING 
   || dogList.get(i).getStatus()!= dogStatus.WALKING
   ||dogList.get(i).getStatus()!= dogStatus.EATING  )){

//do something 

}

Is this the correct way to combine the 3 || conditions? I ask as my program is not behaving as I expect.

Aucun commentaire:

Enregistrer un commentaire