📄 tv.java
字号:
/*
* s2javaoo.lg.ch02.TV.java
* 2007-7-23
* 电视类
*/
package s2javaoo.lg.ch02;
public class TV extends Wiring {
private String type; // 电视种类
private int volume; // 最大音量
/**
* 构造方法
*/
public TV() {
this.setPower(100);
this.setCurrent(50);
this.setType("长虹50寸液晶电视");
this.setVolume(200);
}
/**
* 电视的工作方法
*/
public void work() {
System.out.println("电视在工作");
System.out.println("这台电视的功率是 " + this.getPower());
System.out.println("这台电视的额定电压是 " + this.getPressure());
System.out.println("这台电视的额定电流是 " + this.getCurrent());
System.out.println("这台电视的交直流类型是 " + this.getElectricity());
System.out.println("这台电视的种类是 " + this.getType());
System.out.println("这台电视的最大音量是 " + this.getVolume());
}
/**
* @return type
*/
public String getType() {
return type;
}
/**
* @param type
* 要设置的 type
*/
public void setType(String type) {
this.type = type;
}
/**
* @return volume
*/
public int getVolume() {
return volume;
}
/**
* @param volume
* 要设置的 volume
*/
public void setVolume(int volume) {
this.volume = volume;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -