A static initializer block is a free hanging block in a Java class. It is used mainly for initialization. It is very similar to a constructor, but it cannot be inherited. The static initializer block is declared as follows:
static
{
int i = 5;
//more static initializations
}
This block has neither any return type nor any access modifier. This is why it is known as a free hanging static initializer block. Unlike a constructor, a static initializer block is executed only once, at the time of class loading.
- Best exam simulation CIW master-ciw-enterprise-developer download free trial.
- Click here to download scbcd test study guide and practice question.
- Download free practice test for SUN SCDJWS exam.
- Download practice question and study guide for scjp for exam.
- Download free practice test for SUN SCJP 5/6 exam.
- Download free practice test for scmad SCMAD exam.
- Download free practice test for scwcd SCWCD exam.
- Become SUN Java 5.0 certified.
- Pass SCJP 5.0 Java Upgrade in first attampt.
- Best exam simulation SUN CX310-065 download free trial.
- Click here to get free CX310-066 SCJP Upgrade exam practice questions.
If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.