code is as follows:
abstract class Animal {
int age;
public Animal() {};
public Animal(int age) {
this.age = age;
}
}
class Bird extends Animal implements Fly {
public Bird(int age) {
super(age);
System.out.println("");
System.out.println("" + age + "");
}
}
public void service() {
System.out.println("");
}
}
class Fish extends Animal {
public Fish(int age) {
super(age);
System.out.println("5");
System.out.println("" + age + "");
}
}
public class Test {
public static void main(String[] args) {
Bird bird = new Bird(4);
bird.service();
Fish fish = new Fish(2);
}
}
public interface Fly {
void service();
}
execution problems are as follows: