tg-me.com/topJavaQuizExplain/260
Last Update:
What is the output of the code snippet?
❌ A. 7
❌ B. 9
❌ C. 10
❌ D. 11
❌ E. 15
❌ F. The code will not compile because of line 6
✅ G. The code does not compile for a different reason
Explanation:
This example may look complicated, but the code does not compile. Line 8 is missing the required parentheses around the boolean conditional expression. Since the code does not compile and it is not because of line 6, option G is the correct answer. If line 8 was corrected with parentheses, then the loop would be executed twice, and the output would be 11.
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/260