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.
- Download free practice test for scbcd SCBCD exam.
- Become SUN SCDJWS certified.
- Pass SUN scjp - SCJP
- Download free practice test for scjp-5-0 SCJP 5/6 exam.
- Click here to get free scmad SCMAD exam practice questions.
- Download practice question and study guide for scwcd for exam.
- Become SUN Java 5.0 certified.
- Get certified in first attempt download CX310-056 - SCJP 5.0 Java Upgrade simulation.
- Pass SCJP 6.0 in first attampt.
- Get certified in first attempt download CX310-066 - SCJP Upgrade simulation.