本帖最后由 林林鸦 于 2014-3-26 21:17 编辑
- public interface Null {}
- public class Person {
- public final String first;
- public final String last;
- public final String address;
- public Person(String first, String last, String address) {
- super();
- this.first = first;
- this.last = last;
- this.address = address;
- }
- @Override
- public String toString() {
- return "Person [first=" + first + ", last=" + last + ", address="
- + address + "]";
- }
-
- public static class NullPerson extends Person implements Null {
- private NullPerson(){ super("None", "None", "None"); }
- public String toString() { return "NullPerson"; }
- }
- public static final Person NULL = new NullPerson();
- }
复制代码
内部类NullPerson的构造器器用private声明了,为什么还能再内部类的外部调用? |