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
Is string a datatype?
What is prime number in java?
Do loops java?
describe synchronization in respect to multithreading? : Java thread
How to make a read-only class in java?
What are the differences between heap and stack memory?
Is arraylist zero based?
What is a function in programming?
Where is const variable stored?
Does java runtime require a license?
What things should be kept in mind while creating your own exceptions in java?
What are the three parts of a lambda expression? What is the type of lambda expression?
what do you understand by synchronization? Or what is synchronization and why is it important? Or describe synchronization in respect to multithreading? Or what is synchronization? : Java thread
What is map java?
How do you join strings in java?