hottub.java
来自「Head first design pattern这本经典书的 源码」· Java 代码 · 共 46 行
JAVA
46 行
package headfirst.command.party;public class Hottub { boolean on; int temperature; public Hottub() { } public void on() { on = true; } public void off() { on = false; } public void circulate() { if (on) { System.out.println("Hottub is bubbling!"); } } public void jetsOn() { if (on) { System.out.println("Hottub jets are on"); } } public void jetsOff() { if (on) { System.out.println("Hottub jets are off"); } } public void setTemperature(int temperature) { if (temperature > this.temperature) { System.out.println("Hottub is heating to a steaming " + temperature + " degrees"); } else { System.out.println("Hottub is cooling to " + temperature + " degrees"); } this.temperature = temperature; }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?