细细

mm
04-05-26 0 96

class S {
int i = 9;
private static S me = new S();
private S(){
}
public static S getInstance(){
// 错误递归
System.out.println(S.getInstance().i);
return me;
}
}

class AA {
public static String to(){
return "111";
}
}

class BB extends AA{
public static String to(){
return "222";
}
}

class CC extends AA{
public static String to(){
return "333";
}
}

public class T {
public T() {
AA a = new AA();
System.out.println(a.to());
System.out.println(AA.to());
a = new BB();
System.out.println(((BB)a).to());
System.out.println(BB.to());
a = new CC();
System.out.println(a.to());
System.out.println(CC.to());

}
public static void main(String[] args) {
T t1 = new T();
//S.getInstance();
}

}