forked from echoTheLiar/JavaCodeAcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProduct.java
More file actions
28 lines (23 loc) · 494 Bytes
/
Product.java
File metadata and controls
28 lines (23 loc) · 494 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
28
package designpattern.builder;
import java.util.ArrayList;
import java.util.List;
/**
* 产品类,由多个部件组成
*
* @author liu yuning
*
*/
public class Product {
List<String> parts = new ArrayList<String>();
// 添加产品部件
public void add(String part) {
parts.add(part);
}
// 列举所有的产品部件
public void show() {
System.out.println("---产品 创建---");
for (String part : parts) {
System.out.println(part);
}
}
}