Hi I don't understand the bold bit. Code in a static block will not be executed per creation / instantiation according to me. Am I missing something?
Originally posted by Sam Wong: [QB]You are correct in the sequence. You may be confused by the use of word "constructed" in the tip. If I reword the tip to be: Instance initializer(s) gets executed ONLY IF new is called. So if an object is created via new, then instance initialization and then constructors are executed. Note that static member initialization is done once when the class is loaded. So repeated instance creation will not perform static initialization. However, code residing within a static block will get executed per creation. So be careful with it.