aspose file tools*
The moose likes Beginning Java and the fly likes class loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "class loading" Watch "class loading" New topic
Author

class loading

Bob Gucco
Greenhorn

Joined: Jan 18, 2001
Posts: 16
Would you explain me please a process of loading classes,
sequence of initialization of static variables, static blocks,
public static void main(String[] args)...
How is it beiing determined what to initialize first - by import statements, class calling statements ...?
Would you give me some example on that please?
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi,
I can't explain the processes of loading classes because it is perform by the JVM when the class is required.
As far as initialization is concerned it works in the following order:
1. Static initializers
2. Instance initializers
3. Constructors
Within each part the order (top to bottom) determines initialization.
Can't think of any examples that would show you that though ...
Manfred.
Bob Gucco
Greenhorn

Joined: Jan 18, 2001
Posts: 16
Thank you
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: class loading
 
Similar Threads
static initializations
use of Class.forName()?
Regarding JDBC....
import java.sql
about class.forName