forked from hellokaton/write-readable-code
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample1.java
More file actions
39 lines (29 loc) · 917 Bytes
/
Copy pathExample1.java
File metadata and controls
39 lines (29 loc) · 917 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
29
30
31
32
33
34
35
36
37
38
39
package chapter_05;
import java.util.List;
/**
* 为什么审美是重要的
*
* @author biezhi
* @date 2018/7/3
*/
public class Example1 {
static abstract class StatsKeeper1 {
// A class for keeping track of a series of doubles
abstract void add(double d); // and methods for quick statistics about them
private int count; /* how many so far
*/ public abstract double avgerage();
private double minimum;
private List<Double> pastItems
; double maximum;
}
// A class for keeping track of a series of doubles
// and methods for quick statistics about them
static abstract class StatsKeeper2 {
abstract void add(double d);
abstract double avgerage();
private List<Double> pastItems;
private int count; // how many so far
private double minimum;
private double maximum;
}
}