day10-接口多态的笔记本案例

This commit is contained in:
2026-05-27 17:06:33 +08:00
parent 41617bd714
commit cdad66331c
5 changed files with 120 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package com.inmind.duotai08.test2;
//鼠标类要实现USB接口并具备点击的方法
public class Mouse implements Usb{
@Override
public void open() {
System.out.println("鼠标启动了");
}
@Override
public void close() {
System.out.println("鼠标关闭了");
}
//独有的功能
public void click(){
System.out.println("鼠标点击了");
}
}