When the JVM is started, three class loaders are used
Bootstrap class loader
Extensions class loader
System class loader
The bootstrap class loader loads the core Java libraries[5] located in the <JAVA_HOME>/jre/lib directory. This class loader, which is part of the core JVM, is written in native code.
The extensions class loader loads the code in the extensions directories (<JAVA_HOME>/jre/lib/ext,[6] or any other directory specified by the java.ext.dirs system property).
The system class loader loads code found on java.class.path, which maps to the system CLASSPATH variable.
In JVM, each and every class is loaded by some instanc of java.lang.classloader and its located in java.lang package and we are free to extend to add own functionality to class loading.
Whenever a new JVM started by typing "java MyClass", the "bootstrap class loader" is responsible for loading key Java classes like java.lang.Object
and other runtime code into memory first.
The runtime classes are packaged inside of the JRE\lib\rt.jar file.
Next come java extension class Loader, responsible for loading extension libraries means jar file which provide features that go beyond the core java, in the path given by the java.ext.dirs property.
The Extension Class Loader is responisble for loading all the jar files kept in java.ext.dirs path.
Developer can add his or her application jar or whatever libraries he/she might need to add to the classpath to this extension directly so the Extension Class Loader will load.
The third and foremost class loader from developer perspective is the AppClassLoader or System Class Loader responisble for loading all the classes kept in the path corresponding to java.class.path system property
jvm loads class
executes static blocks
looks for main method and invokes it
So, if there's code in a static block, it will be executed.