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 is multithreading in java?
What is method overloading with type promotion?
Can abstract class have private constructor?
How do you sort a string in alphabetical order in java?
What does nextint () do in java?
What is a memory leak in java?
How to convert string to char and vice versa?
Is null a value?
How do you reverse a word in java?
What is the purpose of static methods and static variables?
Can I declare class as static or private?
What is basic syntax?
Can Exception handling we can handle multiple catch blocks?
How many types of the indexof method are there for strings?
How does a for loop work java?