• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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: 73981
    332
    • 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.
     
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic