Java OCA OCP Practice Question 1514

Question

What statement best describes the notion of effectively final in Java?

  • A. A local variable that is marked final
  • B. A static variable that is marked final
  • C. A local variable that is not marked final but whose primitive value or object reference does not change after it is initialized
  • D. A local variable that is not marked final but whose primitive value or object reference does not change after a certain point in the method


C.

Note

A local variable is effectively final when it's primitive value or object reference does not change after it is initialized, making Option C the correct answer.

Option D is incorrect.

Any change to the variable after it is initialized disqualifies it for being considered effectively final.




PreviousNext

Related