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()
}
}
public interface flyer{
//属性
String speed
public void fly()
public void land()
}
//使用接口
public class brid : flyer
{
void fly()
{
system.out.println("wo hui fly()!")
}
void land()
{
system.out.print("wo jiu shi land()")
}
public void eat()
{
system.out.println("wo shi eat(),wo hen niu x")
fly()
land()
}
}
//在main函数中这样写
brid b = new brid()
b.eat()
以上者搜漏就是漏改按照楼主写的接口!首烂 不知道所谓的十万火急是不是这个意思?
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)