Originally posted by Uvnik Gupta:
Deepak,
You can use "super" only in a derived class. .
I AM using super in the derived class of Test.
Test t = new Test() {
int i = super.i;
};
Here, the anonymous class in the initilizer of the constant field 't' has Test as the super class.
Therefore, super is allowed here. Hence it DOES compile with jikes.
Refer JLS 9.3.1:
If the keyword this (�15.8.3) or the keyword super (15.11.2, 15.12) occurs in an initialization expression for a field of an interface, then unless the occurrence is within the body of an anonymous class (�15.9.5), a compile-time error occurs.