• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

More inheritance and which method of which class is called

 
Jason Attin
Ranch Hand
Posts: 232
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is another interesting quesiton from
Glenn, Mitchell. OCAJP Oracle Certified Associate Java SE 8 Programmer Practice Exams (Kindle Locations 11610-11615). Enthuware. Kindle Edition.

Complete the following code by filling the two blanks -

Select 1 option A. XXX XXX
B. XXX YYY
C. YYY XXX
D. YYY YYY


I answered B for the simple reason that by doing when calling  we called the overridden method of class YYY which doesn't throw an exception, but in fact it seems that that's not the case and the correct answer is D. Why?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's the same reason as this question. Once you understand that thread, circle back to this one.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic