-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
23 lines (19 loc) · 714 Bytes
/
Copy pathMain.java
File metadata and controls
23 lines (19 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import factory.OsFactory;
import factory.MacOsFactory;
import factory.WindowsOsFactory;
import product.IKeyboard;
import product.ITerminal;
public class Main {
public static void main(String[] args) {
// normally would only have 1 statically, but implement here for demo
OsFactory[] factories = new OsFactory[]{new MacOsFactory(), new WindowsOsFactory()};
for (OsFactory factory : factories) {
System.out.println(factory.getClass());
IKeyboard keyboard = factory.createKeyboard();
ITerminal terminal = factory.createTerminal();
keyboard.printLayout();
terminal.print();
System.out.println();
}
}
}