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.
- Click here to download master-ciw-enterprise-developer test study guide and practice question.
- Pass SCBCD in first attampt.
- Download free practice test for SUN SCDJWS exam.
- Become SUN SCJP certified.
- Download practice question and study guide for scjp-5-0 for exam.
- Download practice question and study guide for scmad for exam.
- Become SUN SCWCD certified.
- Download practice question and study guide for CX310-055 for exam.
- Download free practice test for CX310-056 SCJP 5.0 Java Upgrade exam.
- Download free practice test for CX310-065 SCJP 6.0 exam.
- Get certified in first attempt download CX310-066 - SCJP Upgrade simulation.
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.
