tg-me.com/topJavaQuizExplain/199
Last Update:
What is the output of the code snippet?
❌ A. true-false-false
❌ B. false-true-false
❌ C. true-true-true
❌ D. false-true-true
❌ E. false-false-false
✅ F. true-true-false
❌ G. None of the above
Explanation:
The first expression is evaluated from left to right since the operator precedence of & and ^ is the same, letting us reduce it to false ^ sunday, which is true, because sunday is true. In the second expression, we apply the negation operator, (!), first, reducing the expression to sunday && true, which evaluates to true. In the last expression, both variables are true so they reduce to !(true && true), which further reduces to !true, aka false. For these reasons, option F is the correct answer.
BY Explanations “Top Java Quiz Questions”
Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283
Share with your friend now:
tg-me.com/topJavaQuizExplain/199