Exam 1z0-819 All QuestionsBrowse all questions from this exam
Question 37

Given:

What is the result?

    Correct Answer: D

    The code will fail to compile because the local variable 'y' defined in the enclosing scope must be final or effectively final to be accessed within the inner class. Since 'y' is being modified (decremented) within the inner class, it is not effectively final and this leads to a compilation error.

Discussion
[Removed]Option: D

D. Local variable y defined in an enclosing scope must be final or effectively final

d7bb0b2Option: D

D is correct y-- modified variable so, y is not efectively final, then compilation error is thrown

StavokOption: D

java.lang.Error: Unresolved compilation problem: Local variable y defined in an enclosing scope must be final or effectively final D is correct

TADIEWAOption: D

D correct local variable referenced in an inner class should be final or effectively final , here y is post decremented