The if-statement should check whether there´s something wrong with the price value by checking if it´s below 0.
int Money = -356;
if (!(Money > 0)){
System.out.println("Something went wrong");
} else {
System.out.println("We´re good");
}
It says Something went wrong as the Money integer is below 0.
If I add a double variable and put that in the same if-statement, the whole if-statement is false now although the money should still keep it true because I use the double lines || and one true aspect of the statement (Money) should be enough for it to be true.
int Money = -356;
double Reviews = 4.8;
if (!(Money > 0 || Reviews < 5 || Reviews > 0)) {
System.out.println("Something went wrong");
} else{
System.out.println("We´re good");
}
Why does it say We´re good then if the money int makes the upper if-statement true?
Aucun commentaire:
Enregistrer un commentaire