Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Static Initialization Blocks & their alternatives

Static Initialization Blocks and their alternatives in JavaWhy do we need Static Initialization Blocks?The easiest way of initializing fields (static or instance) in Java at the time of their declaration is simply by providing a compile time constant value of a compatible data type. For example:public class InitializationWithConstants{public static int staticIntField = 100;private boolean



This post first appeared on Geek Explains: Java, J2EE, Oracle, Puzzles, And Problem Solving!, please read the originial post: here

Share the post

Static Initialization Blocks & their alternatives

×

Subscribe to Geek Explains: Java, J2ee, Oracle, Puzzles, And Problem Solving!

Get updates delivered right to your inbox!

Thank you for your subscription

×