File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Instance Initializer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Instance Initializer" Watch "Instance Initializer" New topic

Instance Initializer

Shiaber Shaam
Ranch Hand

Joined: Jun 16, 2006
Posts: 252
When a class gets loaded? What happens when the constructor is called? When is static block gets called? What is an instance initializer block?

David Byron

Joined: Jan 20, 2009
Posts: 172


OCMJD 6, OCPJP7, CISSP Baroque Potion, G+
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1789

Understanding the order of operation for how a class gets loaded is really important.

Always remember Static blocks and members load before any instance members get loaded. Anything static gets loaded top to bottom.
Constructors always make a call to super() before doing their thing.

When you do things right, people won't be sure you've done anything at all.
I agree. Here's the link:
subject: Instance Initializer
It's not a secret anymore!