Question: Bird class: class Bird extends Animal { boolean flies; public Bird() { super(); flies = true; } public Bird(String name, boolean flies) { super(name, eggs);

Given the Bird class below, construct the base class Animal from which


Bird class:

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.util.*;
import java.lang.*;
import java.io.*;

class Animal{
 //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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!