What do people use class loading for?

前端 未结 18 1834
暗喜
暗喜 2021-02-02 14:26

So, every Java text book talks about how flexible Java is since it can load classes at run time. Just cobble together a string and give it to Class.forName(), and

18条回答
  •  甜味超标
    2021-02-02 14:54

    Application Servers rely also heavily on ClassLoaders to isolate the different deployed module. E.g.

    • you can deploy the same web app twice under different path
    • two applications can depend on two different version of the same library without conflict.

    Thanks to the magic of class loaders...

提交回复
热议问题