+ 3

whan can do write a operator same "or", but just any of two operant must be true ?

whan can do write a operator same "or", but just any of two operant must be true ?

5th Nov 2016, 7:13 AM
Томошов Максим
Томошов Максим - avatar
2 ответов
+ 4
int x = 15; int y = 17; if(x > 16 || y > 17){ System.out.println("welcome"); // this code will be executed }else{ System.out.println("you are too young "); }
5th Nov 2016, 9:17 AM
Abdelaziz Abubaker
Abdelaziz Abubaker - avatar
0
|| is the or operator example: int currentYear = 2016; if (currentYear == 2016 || currentYear == 2017) { // it is either 2016 or 2017 }
10th Nov 2016, 5:25 AM
Hasan Al-Yazidi
Hasan Al-Yazidi - avatar