class loader

Class Loader Java

Class Loader Java: Here, an object of a class is created without using new keyword using java.lang.ClassLoader. See the code. public class Demo { int x = 10; public static void main(String args[]) throws Exception { Class cls = Class.forName(“Demo”); ClassLoader cLoader = cls.getClassLoader(); Class cl = cLoader.loadClass(“Demo”); Demo d1 = (Demo) cl.newInstance(); System.out.println(d1.x); // …

Class Loader Java Read More »