+ 1
what is
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); }
3 Answers
+ 21
or(||) returns true if any condition evaluates to true
//so output will be 11
but if there will be and(&&) in place of || then 2nd condition will not get checked bcz 1st condition itself results false & output will be 40
+ 13
SoloLearn has compilers, so you just need to copy paste it then run it... instead of polluting the Q&A section :)
+ 12
is a greater than 100? no
is b greater than 3 yes!
since you use the OR operator only one statement has to be true
so the output will be 11