stereo.java

来自「深入浅出设计模式」· Java 代码 · 共 36 行

JAVA
36
字号
package headfirst.command.remote;public class Stereo {	String location;	public Stereo(String location) {		this.location = location;	}	public void on() {		System.out.println(location + " stereo is on");	}	public void off() {		System.out.println(location + " stereo is off");	}	public void setCD() {		System.out.println(location + " stereo is set for CD input");	}	public void setDVD() {		System.out.println(location + " stereo is set for DVD input");	}	public void setRadio() {		System.out.println(location + " stereo is set for Radio");	}	public void setVolume(int volume) {		// code to set the volume		// valid range: 1-11 (after all 11 is better than 10, right?)		System.out.println(location + " Stereo volume set to " + volume);	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?