Preparing for the 0.2 draft

Mark Thornton mthornton at optrak.co.uk
Sat Jan 30 05:38:16 PST 2010


Osvaldo Doederlein wrote:
> 2010/1/30 Fredrik Öhrström <fredrik.ohrstrom at oracle.com>
>
>   
>> Just because every piece of code in Java you have written so far, has
>> been a method inside an object
>>
>>
>>     
> Well, there is the enormous exception of all Java code inside static
> methods, static initializers, and field-initializing expressions. (The
> latter _is_ "code inside an object" because it's compiled into constructors;
> but you can't use 'this' anyway.) 

public class Init
{
    private Init me = this;
}

Is legal. It is static contexts and the arguments of super that can't 
contain this (as far as I can recall).

Mark



More information about the lambda-dev mailing list