Strange behavior using braces in Java

It all depends on the order of execution of initialization statements. Your test demonstrates that this order is:

  1. Static initialization blocks
  2. Instance initialization blocks
  3. Constructors

Edit

Thanks for the comments, now I can quote the appropriate part in the JVM specification. Here it is, the detailed initialization procedure.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)