This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
Originally posted by A Babu: hi all, I have static method ,static varible and static block is there. in which hieararchy the memory is allocated.i mean first for which memory is allocated second for which and so on.
thanks in advance.
Assignment of static variables occurs in a static initializer, unless they are compile-time constants (in which case their "memory" is allocated in the class literal pool), so they are the same thing. This occurs in order of their appearance (and that of other initalizers) in the source file. Static methods do not have memory allocated.
Actually you are on the wrong track, only static variable gets memory. Static Block and static methods doesn't memory. Although if you have static variable also in Methods and Blocks. then also static block will get first executed and all static variables get allocated then all static variable defined outside of the static block get allocated. I hope this will ease your problem.
Cheer Up Babu L.
The Best way to predict your future is to create it - Every great individual common man