21
}
22
23
public
class
PlantB
implements
Plant {
24
25
public
PlantB () {
26
27
System.out.println("create PlantB !");
28
29
}
30
31
public
void
doSomething() {
32
33
System.out.println(" PlantB do something ...");
34
35
}
36
37
}
38
39
//
产品 Fruit 接口
40
41
public
interface
Fruit { }
42
43
//具体产品 FruitA,FruitB
44
45
public
class
FruitA
implements
Fruit {
46
47
public
FruitA() {
48
49
System.out.println("create FruitA !");
50
51
}
52
53
public
void
doSomething() {
54
55
System.out.println(" FruitA do something ...");
56
57
}
58
59
}
60
61
public
class
FruitB
implements
Fruit {
62