question4.java
来自「java课程的资料以及实验的代码」· Java 代码 · 共 44 行
JAVA
44 行
interface Vehicle
{
public void start(int i);
public void stop(int j);
}
class Bike implements Vehicle
{
public void start(int i)
{
System.out.println("Bike started as "+i+"\n");
}
public void stop(int i)
{
System.out.println("Bike stopped as "+i+"\n");
}
}
class Bus implements Vehicle
{
public void start(int i)
{
System.out.println("Bus started as "+i+"\n");
}
public void stop(int i)
{
System.out.println("Bus stopped as "+i+"\n");
}
}
class interfaceDemo
{
public static void main(String args[])
{
Bike bike=new Bike();
bike.start(10);
bike.stop(1);
Bus bus=new Bus();
bus.start(20);
bus.stop(1);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?