编程题:let’s fly
有些动物可以飞,有些昆虫可以飞,甚至有些超人也可以飞,填空完成下列代码。
Some animals can fly, some insects can fly, and even some superhumans can fly, fill in the blanks and complete the following code.
public class Main {
public static void main(String[] args) {
IFlyable one = new Bee();
one.fly();
IFlyable two = new Pigen();
two.fly();
}
}
//定义接口 IFlyable
【】 IFlyable{
//声明方法fly 返回类型为void
【】
}
class Bee 【】{
@Override
【】
public void caimi(){
System.out.println("Bee caimi");
}
}
class Pigen【】{
【】
public void sendMail(){
System.out.println("Pigen can send mail");
}
}
### 输入格式:
### 输出格式:
输出方法运行结果
### 输入样例:
在这里给出一组输入。例如:
in
### 输出样例:
在这里给出相应的输出。例如:
out
Bee fly wong wong wong
Pigen fly hua hua hua
答案:若无答案欢迎评论
Some animals can fly, some insects can fly, and even some superhumans can fly, fill in the blanks and complete the following code.
public class Main {
public static void main(String[] args) {
IFlyable one = new Bee();
one.fly();
IFlyable two = new Pigen();
two.fly();
}
}
//定义接口 IFlyable
【】 IFlyable{
//声明方法fly 返回类型为void
【】
}
class Bee 【】{
@Override
【】
public void caimi(){
System.out.println("Bee caimi");
}
}
class Pigen【】{
【】
public void sendMail(){
System.out.println("Pigen can send mail");
}
}
### 输入格式:
### 输出格式:
输出方法运行结果
### 输入样例:
在这里给出一组输入。例如:
in
### 输出样例:
在这里给出相应的输出。例如:
out
Bee fly wong wong wong
Pigen fly hua hua hua
答案:若无答案欢迎评论