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 is the difference between a jdk and a jvm?
What is jpa project?
What are the differences between java’s old java date api and java 8’s date and time api?
Is jar an executable?
is hibernate a technology or framework?
please suggest me final year project ideas for computer engg.on java as soon as possible becaus eo want to sumbit project name. and i am very confused.
Which version of my browser should I use? : java security
I run a web server. Am I at risk? : java security
why is java not 100% oops?
Who developed rxjava?
hibernate3.jar file contain 7 dependency jar files what is that ?
What is lazy loading in jpa?