aspose file tools*
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
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Instance Initializer" Watch "Instance Initializer" New topic
Author

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?


$Hi/\bEr
David Byron
Rancher

Joined: Jan 20, 2009
Posts: 172

Here....


SCJD 6, OCPJP7, Baroque Potion, G+
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1669
    
  11

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Instance Initializer