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 do you mean by constant time complexity?
Is string pool garbage collected?
Can a constructor have different name than a class name in java?
Can a top level class be private or protected?
Is main a keyword in java?
Can a constructor be private and how are this() and super() method used with constructor?
How do you use spaces in java?
Is boolean a wrapper class in java?
Describe different states of a thread.
Give me example of derived data types.
Explain listiterator and methods in listiterator?
What are user defined exceptions?
How to add menushortcut to menu item?
What is the difference in between cpp and java? Can u explain in detail?
What are the advantages and disadvantages of reference counting in garbage collection?