Bruce Eckel 49edcc8b17 reorg
2015-06-15 17:47:35 -07:00

28 lines
747 B
Java

//: typeinfo/Person.java
// ©2015 MindView LLC: see Copyright.txt
// A class with a Null Object.
import com.mindviewinc.util.*;
class Person {
public final String first;
public final String last;
public final String address;
// etc.
public Person(String first, String last, String address){
this.first = first;
this.last = last;
this.address = address;
}
@Override
public String toString() {
return "Person: " + first + " " + last + " " + address;
}
public static class NullPerson
extends Person implements Null {
private NullPerson() { super("None", "None", "None"); }
@Override
public String toString() { return "NullPerson"; }
}
public static final Person NULL = new NullPerson();
} ///:~