About Question enthuware.ocpjp.v7.2.1480 :

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
emj211
Posts: 5
Joined: Wed Apr 17, 2013 2:41 pm
Contact:

About Question enthuware.ocpjp.v7.2.1480 :

Post 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.

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

Re: About Question enthuware.ocpjp.v7.2.1480 :

Post by admin »

Yes, that is correct.
HTH,
Paul.

The_Nick
Posts: 132
Joined: Thu May 16, 2013 9:23 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1480 :

Post by The_Nick »

Why I am seeing only answer number 1 as the correct?
Which is the other one?
Thanks in advance.
The_Nick.

ksnortum
Posts: 30
Joined: Fri Dec 07, 2012 6:09 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1480 :

Post 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.

ksnortum
Posts: 30
Joined: Fri Dec 07, 2012 6:09 pm
Contact:

Re: About Question enthuware.ocpjp.v7.2.1480 :

Post 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(); }

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

Re: About Question enthuware.ocpjp.v7.2.1480 :

Post by admin »

The code given in the explanation compiles fine. I just tried it.
HTH,
Paul.

The_Nick
Posts: 132
Joined: Thu May 16, 2013 9:23 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1480 :

Post 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.

Student
Posts: 53
Joined: Fri Sep 20, 2013 7:20 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1480 :

Post 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.

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

Re: About Question enthuware.ocpjp.v7.2.1480 :

Post 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.

Student
Posts: 53
Joined: Fri Sep 20, 2013 7:20 am
Contact:

Re: About Question enthuware.ocpjp.v7.2.1480 :

Post by Student »

Okey dokey, cheers.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests