Return to site

JAVA CERTIFICATION QUESTION: Quiz yourself: Using subclasses and covariant return types

· java,ocp

When overloading a Java method, be careful to specify the appropriate return types.

Given the following two classes and the task of creating a subclass of BirdsFarm:

 

Which of the following methods will be allowed in the new class? Choose one.

 

A. public List getAllBirds() { /* ... */ }

 

B. public List getAllBirds() { /* ... */ }

 

C. public ArrayList getAllBirds() { /* ... */ }

 

D. public ArrayList getAllBirds() { /* ... */ }

 

 

 

 

 

 

·ꓛ uoᴉʇdo sᴉ ɹǝʍsuɐ ʇɔǝɹɹoɔ ǝɥꓕ :uoᴉsnๅɔuoꓛ