tg-me.com/topJavaQuizExplain/217
Last Update:
Which is true about the code?
❌ A. The first compiler error is on line A
❌ B. The first compiler error is on line B
❌ C. The first compiler error is on line C
❌ D. The first compiler error is on line D
✅ E. The code compiles successfully
Explanation:
Lambdas are only allowed to reference effectively final variables. You can tell the variable j is effectively final because adding a final keyword before it wouldn’t introduce a compile error. Each time the else statement is executed, the variable is redeclared and goes out of scope. Therefore, it is not re-assigned. Similarly, length is effectively final. There are no compile errors, and option E is correct.
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/217