Java OOP

 

SHORT ANSWER QUESTIONS

INTERFACES & POLYMORPHISM

 

SOLUTIONS


1-implements

 

2-class, interface

 

3-method

4-true

5-all

 

6-a

 

7-b

 

8-b

 

9-d

 

10-no

 

11-@Override 

 

12-true

 

13-Both method headers are missing their return-type.


14-The class Coconut needs to implement both methodA and methodB.

 

15-Because the method() in Coconut does not have an int parameter, it is not a match to the methodA in the interface.  So we are not implementing the methods from the interface.

 

16-The @Override used over methodC() means that methodC() would have to be in the interface.  As it is not there, Java gives an error.  We could simply remove @Override over the methodC header.