Could anyone explain how Java executes this code? I mean the order of executing each statement.
public class Foo
{
boolean flag = sFlag;
static Foo f
foo is instantiated during the static initialization of the class, and before sFlag was initialized, and the default value of a boolean is false.
Foo is initialized to the instance
2.a The instance member flag is initialized to the value of sFlag (false by default)
Please refer to JLS §12.4 for more details.