harmeet saini wrote:
Hi Phil i am not able to understand how does static change this ?
see the below code everything will be clear.................
when we run any class files the execution starts from static method......
JVM first searches the All static method and run them........and after that when it starts the main
the main execution of the program starts......
see in the above code first all the static block executes then when JVM reaches the Main method then it will
create a object and run its contructor........but before running any construction it will see if there is any annonymous block is there
then before running the default constructor..it will run its anonymous block
So, when we create any object........
first anonymouse block executes and then default constructor....