Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

weird certification question.

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • 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.

 
Stefan Brandenberger
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • 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:



 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • 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
Java Mac Safari
  • Mark post as helpful
  • send pies
  • 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
    • 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.
     
    Campbell Ritchie
    Sheriff
    Pie
    Posts: 49466
    64
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Which mock exam: please quote the source.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic