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.
- Download free practice test for master-ciw-enterprise-developer Master CIW Enterprise Developer exam.
- Become SUN SCBCD certified.
- Download free practice test for SUN SCDJWS exam.
- Best exam simulation SUN scjp download free trial.
- Pass SUN scjp-5-0 - SCJP 5/6
- Click here to download scmad test study guide and practice question.
- Click here to download scwcd test study guide and practice question.
- Download free practice test for CX310-055 Java 5.0 exam.
- Pass SUN CX310-056 - SCJP 5.0 Java Upgrade
- Download free practice test for CX310-065 SCJP 6.0 exam.
- Pass SCJP Upgrade in first attampt.