Win a copy of OCP Oracle Certified Professional Java SE 11 Developer Practice Tests this week in the OCP 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
Sheriffs:
  • Devaka Cooray
  • paul wheaton
  • Mark Herschberg
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
  • Jj Roberts
Bartenders:
  • Carey Brown
  • salvin francis
  • Piet Souris

WILEY JAVA OCA Question error (Sybex 07.10)

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In this question it is stated that the following is correct:
'A checked exception thrown by a method in the parent class must be the same or narrower than the exception thrown by the method in the child class'

Which is absolutely incorrect because the inverse is true, namely:
'A checked exception thrown by a method in the parent class must be the same or BROADER than the exception thrown by the method in the child class'
 
Marshal
Posts: 72036
312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I think you are correct. Have you checked the book's errata paage?
 
Jens van Groeningen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you!

I checked the following errata page: https://www.selikoff.net/java-oca-8-programmer-i-study-guide/

The error I discovered was not on this page and the page instructed me to post the error on this forum.
 
Campbell Ritchie
Marshal
Posts: 72036
312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. I shall move you to the exam forum where the authors check the posts regulatrly.
 
Jens van Groeningen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you!
Much appreciated
 
Jens van Groeningen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just noted that I referenced the wrong errata page. This is the correct errata page for the test exam questions: https://www.selikoff.net/jpt/ that directed me to this forum 😁
 
author & internet detective
Posts: 40469
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
Jens,
That question states "Which of the following statements about overriding a method is incorrect".

Option C (A checked exception thrown by a method in the parent class must be the same or narrower than the exception thrown by the method in the child class) is the correct answer to this question. Because it is the *incorrect* option. So we both agree that the statement in option C is untrue.
 
Jens van Groeningen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Jeanne,

The question states the following:

Which of the following statements about overriding a method is incorrect?
A. The return types must be covariant.
B. The access modifier of the method in the child class must be the same or broader than the method in the superclass.
C. A checked exception thrown by the method in the parent class must be thrown by the method in the child class.
D. A checked exception thrown by a method in the parent class must be the same or narrower than the exception thrown by the method in the child class.

And it states that the correct answer is C, and thus claiming that D (A checked exception thrown by a method in the parent class must be the same or narrower than the exception thrown by the method in the child class) is a valid statement, which it is not.
 
Jeanne Boyarsky
author & internet detective
Posts: 40469
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
Oh, we are talking about D. We have different text: You posted:

D. A checked exception thrown by a method in the parent class must be the same or narrower than the exception thrown by the method in the child class.



My printed copy of the book has

D. A checked exception thrown by a method in the child class must be the same or narrower than the exception thrown by the method in the parent class.



Can you double check the text isn't flipped in yours. And assuming it is wrong, what book format are you using? Printed, kindle, etc?
 
Jens van Groeningen
Greenhorn
Posts: 7
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne,

I am doing the 'OCA / OCP Java SE 8 Programmer Practice Tests' using Wiley Efficient Learning.
A screenshot of how the question is displayed on Wiley Efficient Learning is attached.

Java_Question_0710.PNG
Java OCA question 07.10
Java OCA question 07.10
 
Jeanne Boyarsky
author & internet detective
Posts: 40469
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
Thanks Jens! I've added it to the errata list and credited you.
 
Jens van Groeningen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you!
Glad I could help.
 
reply
    Bookmark Topic Watch Topic
  • New Topic