-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestDesign.java
More file actions
60 lines (43 loc) · 2.05 KB
/
TestDesign.java
File metadata and controls
60 lines (43 loc) · 2.05 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import creationalpatterns.abstractfactory.*;
import creationalpatterns.builder.Person;
import creationalpatterns.factory.Circle;
import creationalpatterns.factory.Shape;
import creationalpatterns.factory.ShapeFactory;
import creationalpatterns.factory.Square;
import creationalpatterns.factorymethod.BeefBurgerRestaurant;
import creationalpatterns.factorymethod.Restaurant;
import creationalpatterns.prototype.Prototype;
import creationalpatterns.prototype.Student;
import creationalpatterns.singleton.LoggerSingleton;
import objectDesigns.ChoSaint;
import objectDesigns.HotBeverage;
import objectDesigns.Tea;
import javax.swing.text.TabableView;
public class TestDesign {
public static void main(String[] args) {
Shape circle = ShapeFactory.createShape("Circle");
circle.draw();
System.out.println("----------------------------------");
Restaurant restaurant = new BeefBurgerRestaurant();
restaurant.orderBurger();
System.out.println("----------------------------------");
FurnitureFactory modernFactory = new ModernFurnitureFactory();
Chair modernChair = modernFactory.CreateChair();
modernChair.createChair();
FurnitureFactory victorianFactory = new VictorianFurnitureFactory();
CoffeeTable victorianCoffeeTable = victorianFactory.CreateCoffeeTable();
victorianCoffeeTable.createCoffeeTable();
LoggerSingleton loggerSingleton = LoggerSingleton.getLoggerInstance();
LoggerSingleton loggerSingleton1 = LoggerSingleton.getLoggerInstance();
System.out.println(loggerSingleton.hashCode());
System.out.println(loggerSingleton1.hashCode());
loggerSingleton.writeLog("Log");
Person kyawkyaw = new Person.PersonBuilder("Kyaw Kyaw", 23)
.addJob("Developer").addAddress("Yangon").build();
System.out.println("Info" + kyawkyaw);
Student stuMgMg = new Student("MgMg", 23);
System.out.println(stuMgMg);
Student stuAungAung = (Student) stuMgMg.clone();
System.out.println(stuAungAung);
}
}