Competitions
PP2. Week 7: April 19 - 25
Java Interface Bird
Implement interfaces Eat, Fly, Sleep.
Implement class Bird that implements interfaces Eat, Fly, Sleep.
interface Fly {
void fly();
}
interface Eat {
void eat();
}
interface Sleep {
void eat();
}
class Bird implements Fly, Eat, Sleep
{
public void fly() {
}
public void eat() {
}
public void sleep() {
}
}
Input
Each line contains one of the bird's action: fly, eat or sleep.
Output
For each bird's action print in a separate line the corresponding output.
Input example #1
fly sleep eat
Output example #1
Bird flies Bird sleeps Bird eats