This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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: 171


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

Joined: Sep 14, 2009
Posts: 1659

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
Similar Threads
Forward references to variables??
How to explain this?
is it a valid jsp code
Instance & Static Initializers
braces without name