• Post Reply Bookmark Topic Watch Topic
  • New Topic

Visibility of protected variables via inheritance + reference  RSS feed

 
maciej pawel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am preparing to OCA 8, and while doing some mock tests I encountered two questions I do not understand answer.

Those questions are:



I don't understand why proper answer in both cases is Compilation fails (As marked on pictures)
I wrote the code in Eclipse, run it and everything worked fine. It compiled, and printed output. Maybe because of IDE? Well, writing code in notepad++ (with proper folder structure), compiling it via terminal by javac and running through terminal also gave output and no compilation errors)

What is wrong? Maybe the answer for the question on the answer sheet is wrong and I detected a mistake in the test?
 
Dave Tolls
Ranch Foreman
Posts: 3068
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the code you wrote?
I ask, because I think you copied it down incorrectly.

Ensure you show us the full code, including package statements.
And please use code tags (there's a button at the top of the edit form).
 
Knute Snortum
Sheriff
Posts: 4288
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Tolls wrote:I think you copied it down incorrectly.

I believe those are images.
 
Paul Clapham
Sheriff
Posts: 22844
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, the posted code is an image but maciej retyped that code into Eclipse and had unexpected results. So Dave thinks there might have been errors in that retyping (and so do I).
 
maciej pawel
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right, that was a coding mistake... shame on me. Thank you that you pointed it to me... Topic to be closed.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!