hottub.java
来自「Head first design pattern这本经典书的 源码」· Java 代码 · 共 57 行
JAVA
57 行
package headfirst.command.remote;public class Hottub { boolean on; int temperature; public Hottub() { } public void on() { on = true; } public void off() { on = false; } public void bubblesOn() { if (on) { System.out.println("Hottub is bubbling!"); } } public void bubblesOff() { if (on) { System.out.println("Hottub is not 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) { this.temperature = temperature; } public void heat() { temperature = 105; System.out.println("Hottub is heating to a steaming 105 degrees"); } public void cool() { temperature = 98; System.out.println("Hottub is cooling to 98 degrees"); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?