Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes initialization sequence 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 "initialization sequence" Watch "initialization sequence" New topic
Author

initialization sequence

geeta rai
Ranch Hand

Joined: Sep 18, 2003
Posts: 48
Could someone pls enlighten on the sequence of initialization steps when we have initializer blocks(both static and instance), superclass and subclass constructors in consideration.
Thanks.
Ko Ko Naing
Ranch Hand

Joined: Jun 08, 2002
Posts: 3178
I hope the following link might help you, which I bookmarked long time ago, when I was on my way to SCJP 1.2....
http://www.artima.com/objectsandjava/webuscript/InitCleanup1.html


Co-author of SCMAD Exam Guide, Author of JMADPlus
SCJP1.2, CCNA, SCWCD1.4, SCBCD1.3, SCMAD1.0, SCJA1.0, SCJP6.0
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
geeta,
When I'm curious about things of this nature, I like to write myself a quick example program to see just what happens.
Concerning your curiousity, the following example
Foo

MiniBar

Bar

produces the following output.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
Consider Paul's rocket mass heater.
 
subject: initialization sequence
 
Similar Threads
Please help explain the output
what will be the output
Please explain the initialization sequence in this code
initialization sequence
init blocks and constructor chain