• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Chapter 1 SelfTest question 6

 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Folks,

I would like to draw your attention to Chapter 1 SelfTest question 6 in the Kathy Sierra and Bert Bates book for OCPJP6. The correct answer is

A: Compilation succeeds


Shouldn't the answer be

E: Compilation fails with an error on line 7

? My rationale is that since Phone3 class is implementing Device interface, it should implement it's doIt() method.
Hope somebody can explain. Thank you.

 
author & internet detective
Posts: 41871
908
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
John,
Good question. The relevant bit of code is:



Phone 3 inherits doIt() from Electronic and defines doStuff() itself. The Device interfaces says it must have a doIt() method. And Phone3 does. It just happens to inherit that method from the superclass.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic