File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes order of execution in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "order of execution in java" Watch "order of execution in java" New topic

order of execution in java

Hung Chang

Joined: Oct 21, 2001
Posts: 16
hi guys.
what is the order of execution in java.
static variables/blocks, contructor, instance variables/blocks.
static variables/blocks, instance variables/blocks,contructor.
Michael Bruesch
Ranch Hand

Joined: Sep 23, 2001
Posts: 158
When the class is loaded, the static variables/blocks are initialized first. Then when the class is instantiated, the instance variables/blocks are initialized and then the constructor is executed.

Michael J Bruesch<br /><i>I code, therefore I am.</i>
I agree. Here's the link:
subject: order of execution in java
jQuery in Action, 3rd edition