Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Mock exam 2 - Question 2 misses complie error in answer

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Question No. 2 asks what the result is of the following code, and has a radio button to check an answer.

An error that I see is that this code sample have code lines from 1 to 10, which means it's all one file.
Per file, in java, there can be only one "public" class/interface which results in compile error on line 4 and 5 as well, since the interface and abstract class are declared as "public".
Plus, line No.8 doesn't compile for two reasons, concrete class doesn't override abstract climb method (what makes E as correct answer based on the explanation), and it as well starts with "public"

Please correct if I'm off course, thanks!
4-public-in-one-file.png
[Thumbnail for 4-public-in-one-file.png]
 
author
Posts: 23893
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please QuoteYourSources. Question #2 of what mock?

Henry
 
Artem Lovan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Artem Lovan wrote:OCP Online Chapter 2 Test - Question No. 2 asks what the result is of the following code, and has a radio button to check an answer.

I'm referring to the book "OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide: Exam 1Z1-809"

An error that I see is that this code sample have code lines from 1 to 10, which means it's all one file.
Per file, in java, there can be only one "public" class/interface which results in compile error on line 4 and 5 as well, since the interface and abstract class are declared as "public".
Plus, line No.8 doesn't compile for two reasons, concrete class doesn't override abstract climb method (what makes E as correct answer based on the explanation), and it as well starts with "public"

Same errors for question No. 10.

Please correct if I'm off course, thanks!

 
author & internet detective
Posts: 40400
821
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are correct. I've added this to the errata. We should have made the line numbers as comments.

Note this is in chapter 2 rather than mock exam 2.
 
Artem Lovan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry about confusion regards "mock exam 2". One small thing, there is not "u" in my last name as shown on the errata .
 
Jeanne Boyarsky
author & internet detective
Posts: 40400
821
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Artem Lovan wrote:Sorry about confusion regards "mock exam 2". One small thing, there is not "u" in my last name as shown on the errata .


Sorry, fixed. I copy/pasted and missed a letter overwriting the source row.
 
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic