• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

weird certification question.

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a certification test, I got this question, then Test.doIt method is overriding the abstract class, then what about the interface method ?

Thanks.

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I cant' explain, I just tried out. So my answer ist: it won't compile. Because you do override the method of EEE but you don't implement the method of DDD. This will work:



No... I was wrong... doiIt is not == doIt ;-).

So, after a while, and another try I'd say: it doesn't matter. The method in EEE is implementing and extending. Because both d.doIt() and e.doIt() will execute the method in Test:



 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Edward Chen wrote:In a certification test, I got this question...


A mock exam, right? Real questions cannot be posted.
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's killing two birds with one stone (as they say).
  • Test extends the abstract class EEE. In doing so, it implements EEE's abstract method, doIt.
  • Test also implements the interface DDD. In doing do, it implements DDD's method, doIt.


  •  
    Edward Chen
    Ranch Hand
    Posts: 798
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    marc weber wrote:

    Edward Chen wrote:In a certification test, I got this question...


    A mock exam, right? Real questions cannot be posted.



    Yes, MOCK question.
     
    Marshal
    Posts: 75851
    361
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Which mock exam: please quote the source.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic