/Users/lyon/j4p/src/bookExamples/ch06RefDataTypes/GuardedClass.java
|
1 package bookExamples.ch06RefDataTypes;
2
3 /**
4 * DocJava, Inc.
5 * http://www.docjava.com
6 * Programmer: dlyon
7 * Date: Sep 14, 2004
8 * Time: 3:17:57 PM
9 */
10 public final class GuardedClass {
11 public static final double PI = Math.PI;
12 private GuardedClass(){}
13
14 // guard against others from making an instance.
15 public static GuardedClass getInstance(){
16 return new GuardedClass();
17 }
18
19 GuardedClass gc = GuardedClass.getInstance();
20 }
21