Question: Bird class: class Bird extends Animal { boolean flies; public Bird() { super(); flies = true; } public Bird(String name, boolean flies) { super(name, eggs);
Bird class: import java.util.*; class Animal{
class Bird extends Animal { boolean flies; public Bird() { super(); flies = true; } public Bird(String name, boolean flies) { super(name, "eggs"); this.flies = flies; } }
import java.lang.*;
import java.io.*;
//String name;
//String birthMethod;
public Animal(){};
public Animal(String name, birthMethod){
this.name = "";
birthMethod = "";
}
public String giveBirth(String birthMethod){
return birthMethod;
}
}
Given the Bird class below, construct the base class Animal from which it inherits. For the Animal class, you will need: . A default constructor. A constructor that accepts values for its two String properties: name and birthMethod. A public method named give Birth (no parameters) that returns the value of the birthMethod property (a String).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
