Richard Hayward wrote:
The order in which the statements are encountered in the source code, except that, in lines such as
int x =1;
variable declarations are separated from the assignment part of the statement, and executed first.
Seems weird.
Since this is in reference to runtime, I think it is better to think about when memory is allocated (and zeroed) for instance variables, and when they are initialized. The JLS regards, initializations of instance variables, and instance initializer blocks, running in "textual order"... but obviously, you can't allocate the memory for the instance variable fields at that point -- it needs to be allocated much earlier than that.
Henry
BTW, it is not everyday that the original poster, who ask the question, is the one who follows up to help out others with the same issue (a month later). Nice. You earned a cow.