Page 1 of 1

About Question enthuware.ocpjp.v8.2.1895 :

Posted: Sat Jan 20, 2018 12:26 am
by ssoltanid
"All final or effectively final static variables"

You probably mean : "All final or effectively final variables"

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

Posted: Sat Jan 20, 2018 9:34 am
by admin
No, because the question explicitly states, "...if the inner class is defined in a static method of encapsulating class.

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

Posted: Mon Aug 13, 2018 5:20 pm
by dvc1190
One of the correct options is "All final or effectively final static or automatic variables".
Does this mean:
(1) All final or effectively final static variables and (2) all final or effectively final automatic variables?
Or, does it mean:
(1) All final or effectively final static variables and (2) all automatic variables?

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

Posted: Mon Aug 13, 2018 8:20 pm
by admin
(1) All final or effectively final static variables and (2) all final or effectively final automatic variables.

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

Posted: Thu Mar 25, 2021 2:09 am
by CzakoJanos
"All final or effectively final static or automatic variables"

Only the effective final automatic variables defined in the defining static method. And of course the static ones.

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

Posted: Wed Nov 17, 2021 9:54 am
by Javatje
Exactly, automatic variables defined in other methods cannot be accessed, right?

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

Posted: Wed Nov 17, 2021 11:18 am
by admin
The the problem statement says "..the method..", which means it is talking about the method in which the inner class is defined. It is not about automatic variables of other methods. Automatic variables of one method are never accessible to other other methods anyway.
The explanation also includes a detailed example that illustrates the situation.