0

JAVA

What is the output of the following code? int a = 11; int b = 12; int c = 40; if (a > 100 || b > 3) { System.out.println(a); } else { System.out.println(c); } please explain

16th Aug 2018, 5:32 AM
Ajay Patil
Ajay Patil - avatar
1 Antwoord
+ 1
System.out.println(a); - this line will be executed because if(false || true) will result in true. -> there will be printed the value of A - 11. A>100 gives you false because 11<100; B>3 gives you true because 12>3; false || true is equal to true since in the OR operation you need at least one of the expressions to be true in order for the whole expression to be true
16th Aug 2018, 7:00 AM
MarJan
MarJan - avatar