Question discussion

Given the following piece of code:public interface Guard{ void doYourJob();}abstract public class Dog implements Guard{ }which of the follo…

291564Medium 1 reply 1,890 views
0
Given the following piece of code:public interface Guard{ void doYourJob();}abstract public class Dog implements Guard{ }which of the following statements is correct?
  • AThis code will not compile, because method doYourJob() in interface Guard must be defined abstract.
  • BThis code will not compile, because class Dog must implement method doYourJob() from interface Guard.
  • CThis code will not compile, because in the declaration of class Dog we must use the keyword extends instead of implements.
  • DThis code will compile without any errors.
Correct answer: D

Discussion 1

0
CCommunity
This code will compile without any errors.