How you load class What is mechanism to load class ?
Answer : Java Classloader comes with Java Runtime Environment and it dynamically loads Java classes into JVM (Java Virtual Machine). Classes loades only on demand Java runtime envionment has no information about it due to classloader.
Each Java class library is loaded by a class loader. When the JVM is start up there are three class loaders that5 is reponsible for to load the classes as mentioned below:
- Bootstrap class loader : Bootstrap class loader loads all java library which is located in <JAVA_HOME>/jre/lib directory
- Extensions class loader : Extension class loader loads classes which is available in <JAVA_HOME>/jre/lib/ext folder
- System class loader : Extension class loader loads classes which is found in system classpath where it maps to classpath environment variable. This has been implemented by the sun.misc.Launcher$AppClassLoader class.