日期:2014-05-20  浏览次数:20731 次

递归的流程,java崩溃的原因
Java code
import java.util.*;
public class CrashJava
{
    public String toString()
    {
        return "CrashJava Address: " + this + "\n";
    }
    public static void main(String[] args)
    {
        Vector v = new Vector();
        for(int i = 0; i < 10; i++)
        {
            v.addElement(new CrashJava());
        }
        System.out.println(v);
    }
}



------解决方案--------------------
public String toString()
{
return "CrashJava Address: " + this + "\n";/
}

等同于
public String toString()
{
return "CrashJava Address: " + this.toString() + "\n";
}