forked from mastifikator/FantasyJavaPatterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
27 lines (20 loc) · 763 Bytes
/
Main.java
File metadata and controls
27 lines (20 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package Observer;
public class Main {
public static void main(String[] args) {
ObservationTower observationTower = new ObservationTower();
Observer observer = new Observer("Морфеус", observationTower);
King king = new King("Ричард");
General general = new General("Максисилиан");
Admiral admiral = new Admiral("Баркасов");
observer.subscribe(king);
observer.subscribe(general);
observer.subscribe(admiral);
System.out.println("");
observationTower.enemyAttack();
System.out.println();
observer.lookAtTower();
System.out.println();
observationTower.enemyGone();
observer.unsubscribe(admiral);
}
}