What are the different types of class loaders in Java?

Class Loaders are JVM components responsible for dynamically loading Java classes into memory at runtime. They follow a parent delegation model, where a class loader first delegates the loading request to its parent before attempting to load the class itself. This mechanism improves security, avoids duplicate class loading, and ensures consistent class management across applications.

Key Points

Example

When a Java application starts, classes like String and Object are loaded by the Bootstrap ClassLoader. JDK platform modules are loaded by the Platform ClassLoader, while application-specific classes such as Employee or CustomerService are loaded by the Application ClassLoader.

public class ClassLoaderDemo {

    public static void main(String[] args) {

        System.out.println(
            String.class.getClassLoader());

        System.out.println(
            ClassLoaderDemo.class.getClassLoader());
    }
}

Output

null

jdk.internal.loader.ClassLoaders$AppClassLoader

Interview Tip

A concise interview answer is: Java primarily uses three class loaders: Bootstrap ClassLoader, Platform (Extension) ClassLoader, and Application (System) ClassLoader. They work in a hierarchical parent delegation model where core JDK classes are loaded first, followed by platform libraries and finally application-specific classes.

Last updated: 16 July 2026

Previous question: What is the difference between Class.forName() and ClassLoader.loadClass()?

Next question: You have two classes, ClassA and ClassB, each dependent on the other. Both classes' constructors require the other class as a parameter. How would you resolve this circular dependency in Java?

More Core Java - Level IV (Advanced) interview questions

All Core Java - Level IV (Advanced) questions