• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

WILEY JAVA OCA Question error (Sybex 07.10)

 
Greenhorn
Posts: 15
  • 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: 80140
418
  • 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: 15
  • 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: 80140
418
  • 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: 15
  • 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: 15
  • 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: 42056
926
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: 15
  • 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: 42056
926
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: 15
  • 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: 42056
926
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: 15
  • 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.
 
I want my playground back. Here, I'll give you this tiny ad for it:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic