class Xxx {
private int i;
Xxx x;
public Xxx() {
i = 10;
x = null;
}
public Xxx(int i) {
this.i = i;
x = new Xxx();
}
public void print() {
System.out.println("i = " + i);
System.out.println(x);
}
public String toString() {
return "i = " + i;
}
}
public class lianxi{
public static void main(String[] args) {
Xxx x = new Xxx(100);
x.print();
System.out.println(x.x);
}
}
|