Page 1 of 1
About Question enthuware.ocpjp.v7.2.1480 :
Posted: Wed Jun 12, 2013 1:13 pm
by emj211
Is it right to say that class Inner cannot be accessed outside of the inner() method? I tried it out I can't seem to access it from main.
Thanks.
Re: About Question enthuware.ocpjp.v7.2.1480 :
Posted: Fri Jun 14, 2013 6:38 am
by admin
Yes, that is correct.
HTH,
Paul.
Re: About Question enthuware.ocpjp.v7.2.1480 :
Posted: Sun Jun 16, 2013 9:37 am
by The_Nick
Why I am seeing only answer number 1 as the correct?
Which is the other one?
Thanks in advance.
The_Nick.
Re: About Question enthuware.ocpjp.v7.2.1480 :
Posted: Tue Jul 16, 2013 3:39 pm
by ksnortum
The_Nick wrote:Why I am seeing only answer number 1 as the correct?
Which is the other one?
Thanks in advance.
The_Nick.
All Static Variables
All Final Automatic Variables.
Re: About Question enthuware.ocpjp.v7.2.1480 :
Posted: Tue Jul 16, 2013 3:41 pm
by ksnortum
There is a problem with the explanation code -- I don't think it changes the point being made but still, it should compile:
Code: Select all
public static void main( String[] args ) { TestClass.inner(); }
Re: About Question enthuware.ocpjp.v7.2.1480 :
Posted: Tue Jul 16, 2013 6:58 pm
by admin
The code given in the explanation compiles fine. I just tried it.
HTH,
Paul.
Re: About Question enthuware.ocpjp.v7.2.1480 :
Posted: Tue Sep 17, 2013 8:15 am
by The_Nick
Hi,
all final automatic variables OK but only the ones within the static enclosing method. (not exactly all) just pointing out.
The_Nick.
Re: About Question enthuware.ocpjp.v7.2.1480 :
Posted: Tue Oct 08, 2013 7:05 am
by Student
Hi,
"Which variables of the encapsulating class"
and in the answer "only si and fai are accessible in class Inner."
Both the answer and explanation given are inconsistent with the wording used in the question. A local (automatic) variable is NOT a variable of the encapsulating class.
Variable fai is NOT a variable of the encapsulating class TestClass. It's a variable of the method inside which Inner is defined.
There are class level (static and non-static) variables, and there are local variables. So the wording of the question and/or answer needs to be revised.
Re: About Question enthuware.ocpjp.v7.2.1480 :
Posted: Tue Oct 08, 2013 8:03 am
by admin
The problem statement has now been updated to "Which variables declared in the encapsulating class or in the method..."
Hope that makes it clearer. Thank you for your feedback!
-Paul.
Re: About Question enthuware.ocpjp.v7.2.1480 :
Posted: Tue Oct 08, 2013 11:29 am
by Student
Okey dokey, cheers.