java小程序编写:1.自定义接口flyer,包含属性speed,包含fly()和land()两个方法

来源:百度知道 编辑:UC知道 时间:2024/05/23 11:57:49
十万火急

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();

以上就是按照楼主写的接口! 不知道所谓的十万火急是不是这个意思?