当赋值语句在 处执行时发生了什么Line 4
,编译器是否忽略new operator
并保持foo
变量为 null 或者发生其他事情来处理这个尴尬的时刻?
public class Foo {
// creating an instance before its constructor has been invoked, suppose the "initializing"
// gets printed in constructor as a result of the next line, of course it will not print it
private Foo foo = new Foo();//Line 4
public Foo() {
System.out.println("initializing");
}
}