About Question enthuware.ocpjp.v8.2.1893 :

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
schchen2000
Posts: 106
Joined: Mon Mar 28, 2016 11:36 pm
Contact:

About Question enthuware.ocpjp.v8.2.1893 :

Post by schchen2000 »

If the inner class is non static, all the static and non-static members of the outer class are accessible (otherwise only static are accessible) So option 1, 2 are valid.
The above quote is from the Explanation part of the question.
If the inner class is non static,....
and
....otherwise only static are accessible....
seem to allude that a static class is allowed inside a method.

To the best of my understanding, no class or variable is allowed to be static inside any method.

Am I missing something here? Thanks.

Schmichael

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1893 :

Post by admin »

The statement starts with, "If the inner class is non static...". Therefore, the otherwise part (i.e. "otherwise only static are accessible") clearly implies that it is talking about the case when an inner class is static. It is a general statement and not for a particular option.

I do not see how the statement implies that a static class is allowed inside a method. The statement is just giving you a simple way to find out which variables are accessible when. It is not talking about anything else.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

schchen2000
Posts: 106
Joined: Mon Mar 28, 2016 11:36 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1893 :

Post by schchen2000 »

admin wrote:The statement starts with, "If the inner class is non static...". Therefore, the otherwise part (i.e. "otherwise only static are accessible") clearly implies that it is talking about the case when an inner class is static. It is a general statement and not for a particular option.

I do not see how the statement implies that a static class is allowed inside a method. The statement is just giving you a simple way to find out which variables are accessible when. It is not talking about anything else.

HTH,
Paul.
Thanks. A static class is not allowed in a method anyway. Is that correct?

Schmichael

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1893 :

Post by admin »

That is correct.
If you like our products and services, please help us by posting your review here.

schchen2000
Posts: 106
Joined: Mon Mar 28, 2016 11:36 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1893 :

Post by schchen2000 »

admin wrote:That is correct.
Thanks. Sorry about being a bit late. :)

excluzzzive
Posts: 4
Joined: Tue Dec 06, 2016 4:11 am
Contact:

Re: About Question enthuware.ocpjp.v8.2.1893 :

Post by excluzzzive »

Hello,

your explanation about criteria answer is:
Even though this variable is local to the method, it is accessible in the inner class defined inside the method because it is declared as final.
But is this correct? Won't it work without final, because in this code snippet it is effectively final?

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1893 :

Post by admin »

No, criteria is not effectively final. It is final. count, on the other hand, is effectively final. Both will be accessible as the explanation notes.
If you like our products and services, please help us by posting your review here.

robiwan
Posts: 1
Joined: Tue Mar 19, 2019 3:50 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1893 :

Post by robiwan »

There IS an assumption that the effectively final variable count is . not used in the various '// lots of code' segments, which I find a bit misleading

admin
Site Admin
Posts: 10046
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocpjp.v8.2.1893 :

Post by admin »

Will Update to avoid this confusion.
thank you for your feedback!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 38 guests