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
What are the differences between getting and load method?
What is a java list?
Is a copy constructor?
What are the different approaches to implement a function to generate a random number?
What is an immutable object? How do you create one in java?
What are encapsulation, inheritance and polymorphism?
Does java allow default arguments?
What are multiple inheritances? Is it supported by java?
What are streams?
What are filterstreams?
What is java util collection?
is it possible to instantiate the math class?
What is the differences between heap and stack memory in java? Explain
What is boolean in java?
What is the method overriding?