Package CN. zhao. base; </P> <p>/** <br/> * demonstration of four types of code blocks <br/> **/<br/> public class codechunkdemo <br/> {< br/> // construct a code block, directly appears in the class, prior to the execution of the constructor <br/>{< br/> system. out. println ("construct code block execution"); <br/>}</P> <p> Public codechunkdemo () <br/>{< br/> system. out. println ("constructor call"); <br/>}</P> <p> // static code block, which is executed only once, the main function is to initialize static properties. <br/> // The static block is executed during class loading. <br/> static <br/>{< br/> system. out. println ("static code block execution"); <br/>}</P> <p> Public static Void main (string [] ARGs) <br/>{< br/> int x = 50; <br/>}</P> <p> int x = 100; </P> <p> // The code above is a common code block that appears directly in the method. <Br/> New codechunkdemo (); <br/>}< br/>