Each class loader is designed to load classes from different locations. For instance, you can actually create a class loader that will load a class file from a networked server or download the binary of a class from a remote web server, etc. The logic that performs this operation is baked into the class loader itself and provides a consistent interface so that clients can load classes regardless of how the class loader actually performs the loading. The BootstrapClassLoader is capable of loading classes from the JVM_HOME/lib directory...but what if you need to load them from a different location??
In short, because there as an infinite (well, not quite) number of ways to load classes and there needs to be a flexible system to allow developers to load them however they want.
每一个类加载器都是为了去在不同的情景下去加载类。比如,你可以从联网服务器上加载一个class文件,也可以从远程web服务器下载二进制类。这么设计是因为我们需要类加载器提供一致的接口,这样客户端就可以加载类但是却不用管类加载器到底是怎么实现的。启动类加载器能够加载JVM_HOME/lib 下的类,但如果我们需要在其他的情况下加载类呢?简单来说,加载类的方法有无数种,我们需要一个灵活的加载器系统去在特定的情况下按照我们的想法来加载类。