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");
raja
Published on 02-Jan-2018 11:42:37
Advertisements