X496: Inheritance - Sparrow

There exists an abstract class Bird.

public abstract class Bird {
    public Bird() {}
    public String eat() {
        return "worms";
    }
    public abstract double fly();
}

Create a subclass of Bird called Sparrow. Overwrite the eat() method so that the Sparrow eats "seeds". Implement the fly() method so that it returns its altitude of 4.13 meters.

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.