Difference between Loading a class using ClassLoader and Class.forName

后端 未结 9 1055
梦如初夏
梦如初夏 2020-11-29 20:38

Below are 2 code snippets

The first one uses ClassLoader class to load a specified class

ClassLoader cls = ClassLoader.getSystemClassL

9条回答
  •  庸人自扰
    2020-11-29 21:01

    But the static initilizer block is only executed when we use class.forname("...");

    I have just tested.

提交回复
热议问题