I fixed the program to get the requested output and even after doing so, it's still not recognizing what's being printed to the screen. Why?
package com.codegym.task.task15.task1520;
/*
Brain training
*/
public class Solution {
public static void main(String[] args) {
Duck duck = new Duck();
Util.fly(duck);
Util.move(duck);
}
public static class Duck implements CanFly, CanMove {
@Override
public void doAction() {
System.out.println("Flying");
}
@Override
public void doAnotherAction() {
System.out.println("Moving");
}
}
public static class Util extends Duck {
static void fly(Duck animal) {
animal.doAction();
}
static void move(Duck animal) {
animal.doAnotherAction();
}
}
public static interface CanFly {
void doAction();
}
public static interface CanMove {
void doAnotherAction();
}
}