Sobes.tech
Junior — Middle

What components are included in the ClassLoader mechanism in Java?

sobes.tech AI

Answer from AI

The ClassLoader mechanism in Java includes several main components:

  • Bootstrap ClassLoader — loads core Java classes from rt.jar (e.g., java.lang.*).
  • Extension ClassLoader — loads Java extensions from the extensions folder.
  • System (or Application) ClassLoader — loads classes from the application's classpath.

Each ClassLoader is responsible for loading classes from specific sources and operates on a delegation principle: if a class is not found in the current loader, the request is passed to the parent. This ensures a hierarchical structure of loaders and prevents class duplication.