Limited access

Upgrade to access all content for this subject

The following code shows the Bird class. Along with other methods, it contains a sound() method that specifies the sound a Bird makes. An Owl is a type of Bird that sounds differently than a normal Bird.

public class Bird
{
    public void sound(){

        // method implementation not shown
    }

    // other methods and variables not shown
}

Given the information above, what is a good design for the Owl class?

I.   the Owl class extends the Bird class
II.  the Owl class overrides all methods from the Bird class
III. the Owl class overrides the sound() method from the Bird class
A

I only.

B

II only.

C

III only.

D

I and II only.

E

I and III only.

Select an assignment template