About Question enthuware.ocajp.i.v7.2.1147 :

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
Brian B
Posts: 13
Joined: Mon Jun 16, 2014 1:07 pm
Contact:

About Question enthuware.ocajp.i.v7.2.1147 :

Post by Brian B »

Is this answer:

"Objects of class B will always have a member variable named i ."

negated by the explanation:

"Note that 'i' is not public or protected. So it will be inherited only if both the classes are in the same package."

???

The given code neither states whether class A and class B are in the same package or not.

One could assume, that since both classes are in the same Java source code file, that they have to be in the same package (although, we are not given that either). I've come to the conclusion that assumptions in programming are dangerous. :D

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

Re: About Question enthuware.ocajp.i.v7.2.1147 :

Post by admin »

You are right. The problem statement is a bit lacking. It has now been updated to make it clear that the code is in the same file.

thank you for your feedback!

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests