GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes weird certification question. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "weird certification question." Watch "weird certification question." New topic
Author

weird certification question.

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
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

Joined: Aug 31, 2009
Posts: 12
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

Joined: Aug 31, 2004
Posts: 11343

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

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


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

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

    Joined: Dec 23, 2003
    Posts: 798
    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

    Joined: Oct 13, 2005
    Posts: 39044
        
      23
    Which mock exam: please quote the source.
     
     
    subject: weird certification question.