when we write class.forName("any one class"); what happens
actually?what it will return?explain stepwise?
Answer Posted / paras
Class.forName("")loads that class in memory ,to create
instance we have to use newInstance()
string _path="classpath loc of class XYZ ex com.aa.ss.XYZ";
Object ob=Class.forName(_path).newInstance();;
((XYZ)ob).any_method_of_XYZ();
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Why isn’t there operator overloading?
Explain the difference between abstract classes and interfaces in java?
Is an empty arraylist null?
How an object is serialized in java?
What is an array in java?
What is the history of java?
What is a classloader in java?
Can a abstract class be declared final?
How do you decide when to use arraylist and linkedlist?
What is the significance of java packages?
What is the java reflection api? Why it’s so important to have?
Can we have any code between try and finally blocks?
What is the difference between logical data independence and physical data independence?
What is this keyword used for?
How do you override a method?