How to load a class programmatically?
Answer / madhu
public class MainClass {
public static void main(String[] args){
ClassLoader classLoader = MainClass.class.getClassLoader();
try {
Class aClass = classLoader.loadClass("com.tech.MyClass");
System.out.println("aClass.getName() = " + aClass.getName());
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
Is This Answer Correct ? | 5 Yes | 0 No |
What does persist mean in java?
can a program use more than one command-line argument?
Do I really have to type in the programs in the book to try them out?
What is the java api?
I am trying to create a new universal user group. Why can't i? : java security
What is the difference between ec2 and lambda?
How long can a lambda function run?
Do I need to install jre if I have jdk?
What is stateless object in java?
What is the use of servlet in java?
Is java installed on windows 10?
how can program polindrome using java