Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The classes are loaded at that moment, when there are needed for the first time. Not earlier.
Static classes an that containing static methods are instantiated on application startup and are not effected by this rule.
When a class is needed, the class loader loads the class and then it's linked:

There are three phases in the linking process:

  1. Verification (Checking format and suitability of this JVM)
  2. Preparation ( Memory allocation etc.)
  3. Resolution (Recursive loading and linking of classes needed by the resolved class)

After that the classes are initialized( static and as needed) and are executed.
When all non-daemon threads are done, the application terminates.

Class Loader Hierarchy

Instrumentation

...