package Bmap;
//创建一个接口
interface Usb{
public void open();
public void close();
}
//调用
class MXDXtest {
public static void main(String[] args)
{
useUsb(new Upan());
useUsb(new Mouse());
}
public static void useUsb(Usb u)
{
u.open();
u.close();
}
}
//创建一个实现类U盘
class Upan implements Usb
{
public void open()
{
System.out.println("Upan open");
}
public void close()
{
System.out.println("Upan close");
}
{
public void open()
{
System.out.println("Mouse open");
}
public void close()
{
System.out.println("Mouse close");
}
}
//创建一个接口
interface Usb{
public void open();
public void close();
}
//调用
class MXDXtest {
public static void main(String[] args)
{
useUsb(new Upan());
useUsb(new Mouse());
}
public static void useUsb(Usb u)
{
u.open();
u.close();
}
}
//创建一个实现类U盘
class Upan implements Usb
{
public void open()
{
System.out.println("Upan open");
}
public void close()
{
System.out.println("Upan close");
}
}
//创建一个实现类鼠标
{
public void open()
{
System.out.println("Mouse open");
}
public void close()
{
System.out.println("Mouse close");
}
}