0
What does basically && operator do?
1 Réponse
+ 1
It requires to have both conditions of the AND operator satisfied to give a true output. If not it'll give a false. For example, you want to buy a concert ticket online and the price of it is 42,80 $, so the answers of the seller site at the moment of the payment could be only one of these two - positive (true) if you pay the price, or negative (false) if you won't. Then:
if (dollars > 42 && cents > 80) {
System.out.println("Thanks, check your email address for retrieve your ticket!");
} else {
System.out.println("Sorry, the price is 42,80 $ to get a ticket.");
}
Hope to being helpful