Module: | Core Architecture, Basics & Control Flow
Q8: Consider the following statements regarding the Java ClassLoader subsystem:
1. The Bootstrap ClassLoader is the root loader, written in native machine code, responsible for loading the core Java API classes.
2. The Extension ClassLoader is primarily responsible for loading application-specific user-defined classes located in the system classpath.
3. The Application ClassLoader is strictly utilized by the JVM to load system extensions from the JRE extension directory.
Which of the above statements is/are correct?
2. The Extension ClassLoader is primarily responsible for loading application-specific user-defined classes located in the system classpath.
3. The Application ClassLoader is strictly utilized by the JVM to load system extensions from the JRE extension directory.
Which of the above statements is/are correct?
✅ Correct Answer: A
🎯 Quick Answer:
The correct statement is 1 only. Statements 2 and 3 are swapped and thus incorrect. The Extension ClassLoader loads classes from the JRE extension directories, while the Application ClassLoader loads user-defined classes from the environment classpath.Structural Breakdown: Java utilizes a hierarchical delegation model for class loading.
The hierarchy consists of: Bootstrap ClassLoader (loads internal JDK classes like java.lang), Extension ClassLoader (loads external library jars from the ext folder), and Application/System ClassLoader (loads classes from the user's defined classpath). Historical/Related Context: The dynamic loading feature means Java does not need to load every single class at startup, vastly reducing initial memory consumption.
This differs from static linking in older compilation languages where the entire application codebase and libraries were bundled into a monolithic executable file.
Causal Reasoning: The delegation hierarchy ensures profound security.
Before an Application ClassLoader attempts to load a user's class (e.g., a maliciously crafted java.lang.String), it delegates the request up to the Bootstrap loader.
The Bootstrap loader will load the legitimate internal String class, ignoring the malicious user-defined one.