What are Class loaders? Explain the types of class loader

What are Class loaders? Explain the types of class loader

Class loaders are the part of the Java Runtime Environment that dynamically loads Java classes into the Java virtual machine. It is responsible for locating libraries, reading there content and loading the classes contained within the libraries. When JVM is started three class loaders are used

1. Bootstrap class loader

2. Extensions class loader

3. System class loader

Bootstrap class loader loads the core java libraries. It is written in native code. The bootstrap class loader is responsible for loading key java classes like java.lang.Object and other runtime code into memory. The runtime classes are packaged inside jre/lib/rt.jar file.

Extensions class loader loads the code in the extension directories. It is implemented by ExtClassLoader class.

System class loader the code found on the java.class.path which map to the system class path variables. It is implemented by AppClassLoader class. All user classes by default are load by the system class loader.
Dynamic loading
Dynamic loading - Classloader and its method LoadClass() is used for dynamic loading of a class...
Explain how to implement Shallow Cloning.
Shallow Cloning - Generally cloning means creating a new instance of a same class and copy all the fields to the new instance...
Explain how to implement Deep Cloning.
Deep Cloning - Deep cloning makes a distinct copy of each of object’s field...
Post your comment