abstract class Animal {
private double weight;
abstract void say();
abstract void eat();
public Animal() {
this.weight = 0;
}
public Animal(double weight) {
this.weight = weight;
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
}
interface Flyable {
void flySpeed();
}
class Glede extends Animal implements Flyable {
public void flySpeed() {
System.out.println("10m/s");
}
@Override
void say() {
System.out.println("啊啊啊啊");
}
@Override
void eat() {
System.out.println("老鼠");
}
}
class Pigeon extends Animal implements Flyable {
public void flySpeed() {
System.out.println("5m/s");
}
@Override
void say() {
System.out.println("咕咕咕咕");
}
@Override
void eat() {
System.out.println("虫子");
}
}
public class Test {
public static void main(String[] args) {
Glede glede = new Glede();
glede.flySpeed();
glede.say();
glede.eat();
Pigeon pigeon = new Pigeon();
pigeon.flySpeed();
pigeon.say();
pigeon.eat();
}
}