Please write code in java This is object oriented program 1st photo it has the B
ID: 3705160 • Letter: P
Question
Please write code in java This is object oriented program 1st photo it has the Bird class so u should not modify it in any how Then you should go to the third photo Owel class and make it as subclass so it will be Owl extend Bird { And you right the brogram I included the 4th Photo for u just to learn from it crow extend Bird so if u know what u doing disregarded Finally u have to go 2nd phote and write the code for BirdTest class So in total I need from you two codes One for BirdTest And one for Owl extend bird Do not medfy Bird.java And crow photot 4 its for you to learn from it if u need it thanksHistory 31 ? /** * Bird Object. 5DO NOT MODIFY THIS CLASS 6 7 public class Bird f private String color; 10 12 13 Constructor. public Bird (String colorIn) t color colorín; 15 16 17 18 19 20 21 * Prints a generic bird call. public void birdCall0 f system.out.println ("Generic Bird Sound!"); 23 24 25 26 27 Retrieves the color field. public string getcolor t 29 30 31 32 return color: Output- Module11 (run-single
Explanation / Answer
Bird.java
import java.util.*;
public class Bird{
private String color;
public Bird(String colorIn){
color = colorIn;
}
public void birdCall(){
System.out.println("Generic Bird Sound!");
}
public String getColor(){
return color;
}
}
Owl.java
import java.util.*;
public class Owl extends Bird{
//private String color;
public Owl(String colorIn){
//color = colorIn;
super(colorIn);
}
public void birdCall(){
System.out.println("Hoot!");
}
public String getColor(){
return "Red";
}
}
BirdTest.java
import java.util.*;
public class BirdTest{
public static void main(String[] args){
Owl owl = new Owl("Red");
owl.birdCall();
}
}
//first compile Bird.java next Owl.java then BirdTest.java