can anyone tell me the difference between line 1 and line 2:
static ClassA instance;
// ClassB implements ClassA
instance = (ClassA) new ClassB(); // line 1
instance = (ClassA) Class.forName(ClassB).newInstance(); // line 2
As
java api specification stated that newInstance() is to create a new instance of the class represented by this Class object, then i assume there is no difference using "new" keyword to create a new instance of a class. Pls correct me if i am wrong.