Since B not static, it needs some instance of A so that it can exist, therefore an error.
If B is static, the error disappears.
Oh, forget the bullshit. This is a bug , and it runs on ideone in Java7 mode. However, until Java 7, this did not work - see this question , and you need to either
Change B to static
Add Constructor
C() { A.this.super(); }
And then it will work.
The reason this happens before Java 7 may be the following is from JLS:
Let C be an instance of the class, S be the direct superclass of C, and I be the instance to be created.
The implicit super is invoked in the immediate incoming instance of I with respect to S.
In earlier JLS, an instance that directly includes is defined as
Let O be the innermost lexically encompassing class, S be a member, and n be an integer such that O is the nth lexically encompassing class C. The instantly included instance i in S is the nth lexical encompassing instance of this.
However, in Java 7 :
Let O be the innermost lexically encompassing class S, n be an integer such that O is the nth lexically encompassing class C.
The instance i included in the instance of S is the nth lexically encompassing instance of this.
Thus, in the past it was the innermost lexically encompassing class, S is a member , and now it is the most lexically encompassing class S , so it has changed from C to A , so the code works in Java 7.