Page 1 of 1

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

Posted: Fri Jul 11, 2014 8:30 am
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

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

Posted: Sun Jul 13, 2014 7:18 am
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!