我在主要方法中創建了一個對象d,在構造函數之後,然後是另一個對象,f。我需要了解爲什麼Output
發生異常(Exception in thread "main" java.lang.StackOverflowError
)。但是,如果我沒有在構造函數之後創建對象d,程序將成功運行。嵌套類,內部類
public class OuterTwo {
public OuterTwo() {
System.out.println("OUTER!");
}
OuterTwo d = new OuterTwo();
public static void main(String[] args) {
OuterTwo f = new OuterTwo();
}
}
我也將是一個源感激一個良好的書面與有關JAVA嵌套類說明教程。 – Insanovation 2014-10-09 13:13:51
我在這裏沒有看到任何嵌套類 – talex 2014-10-09 13:18:04