forked from teddyzhang1976/ThinkInJava4thSampleCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitch.java
More file actions
11 lines (10 loc) · 382 Bytes
/
Switch.java
File metadata and controls
11 lines (10 loc) · 382 Bytes
1
2
3
4
5
6
7
8
9
10
11
//: exceptions/Switch.java
package exceptions; /* Added by Eclipse.py */
import static net.mindview.util.Print.*;
public class Switch {
private boolean state = false;
public boolean read() { return state; }
public void on() { state = true; print(this); }
public void off() { state = false; print(this); }
public String toString() { return state ? "on" : "off"; }
} ///:~