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 |
Define network programming?
what are the steps in JDBC connectivity..???
Why sun introduce concept of anonymous class? What is need and real life use of anonymous class
What are jpa annotations?
What is explicit casting?
What is scrollable resultset in java?
How do I enable java in firefox?
Is php faster than java?
What is mdb in java?
What is the difference between the boolean & operator and the && operator?
Java prints out a ton of digits when I system.out.println() a double. How can I format it so it displays only 3 digits after the decimal place?
Which is the Best institute to do academic Project in Java? Need information about institutes at Ameerpet, Hyderabad.