Excel表格网

java 定义一个鼠标类

95 2024-03-06 20:45 admin   手机版
java public class Mouse { private String brand; private int buttons; private boolean wireless; public Mouse(String brand, int buttons, boolean wireless) { this.brand = brand; this.buttons = buttons; this.wireless = wireless; } public String getBrand() { return brand; } public void setBrand(String brand) { this.brand = brand; } public int getButtons() { return buttons; } public void setButtons(int buttons) { this.buttons = buttons; } public boolean isWireless() { return wireless; } public void setWireless(boolean wireless) { this.wireless = wireless; } public void click() { System.out.println("Mouse clicked"); } public void scroll(int direction) { System.out.println("Scrolling " + (direction > 0 ? "up" : "down")); } }
顶一下
(0)
0%
踩一下
(0)
0%
相关评论
我要评论
用户名: 验证码:点击我更换图片
上一篇:返回栏目