Question: Java has 3 class loaders:

* BootStrap,
* Extension and
* System

and they have one role; loading classes from different packages.

But why does Java have 3 different class loaders instead of just one, since one class loader can load all the necessary classes?

Answer: 
The main usage of class loaders is in application servers. 

You want to be able to start Tomcat (for example). This already needs at least one classloader to run tomcat itself. 

Then you want to be able to deploy an application into Tomcat. So Tomcat itself needs to load an analyze the classes of the application, which didn't even exist when Tomcat was started.

Then you want to be able todeploy another application in Tomcat. Maybe this second application uses a library that the first one also uses, but in a different version. So you want each app to have its own isolated class loader, otherwise the classes of app 2 might interfere badly with the classes from app 1.

Then you want to be able to undeploy one of the webapps. So its class loader must be destroyed and garbage-collected, to avoid a huge memory leak.

There are of course many other usages, but that's the one that is the most commonly used (in my experience).
1. Multiple class loaders are present to load multiple applications
 simultaneously(One to load Server & Other to deploy in the server).
2. Each loader has a hierarchy to load only certain
 classes to ensure security among them.