In this question, the answer ' count' is correct, with the statement " Although count is a local variable but its value does not change anywhere in the code. Hence, it is effectively final and is therefore accessible from the inner class."
However, part of the ' code' is the comment " // lots of code....."
How can we know that count is effectively final, if we do not have all the code?
About Question enthuware.ocpjp.v11.2.1893 :
Moderator: admin
-
- Posts: 6
- Joined: Tue May 03, 2022 7:50 am
- Contact:
-
- Site Admin
- Posts: 10045
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v11.2.1893 :
This is the standard practice adopted by the exam. Any code that is not shown should be assumed to not affect the answer. In the exam, you will find code snippets (where only a few lines of code are shown, which won't compile on its own) or comments such as //setter and getter go here. You need to assume that that code is valid and the answer doesn't depend on it.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 45 guests