Java / JVM Architecture (Java21) Interview questions
What are the types of class loaders in JVM?
The JVM uses a small hierarchy of class loaders, each responsible for a different part of the classpath, and each (except the Bootstrap loader) has a parent it can delegate to.
| Class Loader | Loads |
| Bootstrap ClassLoader | Core JDK classes (java.lang.*, java.util.*) from the JDK's own modules, implemented natively. |
| Platform ClassLoader | Platform/JDK-supplied modules that are not part of the core bootstrap set (formerly called the Extension ClassLoader). |
| Application (System) ClassLoader | Classes from the application classpath or module path. |
| Custom ClassLoader | User-defined loaders, e.g. for plugin systems or hot-reloading frameworks. |
In Java 21, this model is unchanged since the module system arrived in Java 9: all three built-in loaders extend the same internal BuiltinClassLoader base.
More Related questions...