Hyderabad, , India
Android, C Plus Plus, HTML
1 Comment | 43 Views | 02 Apr 13  | Srinivasarao Mahanti
when we define static block and static method which will be execute first and if we define more than one static block which will exceute fir
One of the InterView Question i39v faced... when we define static block and static method which will be execute first and if we define more than one static block which will exceute first in order. Obviously Static block will execute first only and static method executes only when we called explicitly. and if we define more than one static block they will be executed in order they defined in the program.... see the below example............ class StaticParam static int a static System.out.printlnquotStatic Blockquot static System.out.printlnquotStatic Block 222quot static void m1int a aa System.out.printlna System.out.printlnStaticParam.a public static void mainString args System.out.printlna m150 System.out.printlnquotHello Worldquota

    • Social Share
      for this Blog

    • first Execute static block because when ever compile the application at the time first static block will be loaded. after when ever we call with class name followed by method at the time static method will be executed


Porfolio And Blogs
Srinivasarao Mahanti follows various companies, these companies and employers can view Srinivasarao's resume.
Upload your resume to get best job opportunities.

Register free!