How many ways can get the instance of a Class class in Java?

Java 8Object Oriented ProgrammingProgramming

You can create an object of the class named Class in two ways −

Using new keyword as −

Class obj = new Class();

Using the forName() method of the class named Class.

Class obj = Class.forName("DemoTest");
Published on 02-Jan-2018 07:12:37