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 |
Can the main method be overloaded?
What is connection pooling in java?
Iam working as a Project Lead in a s/w comp.The follwing question was asked in HCL interview. What about the schedule slippage? If the developer has taken more time than the specified time. How do you adjust the time? From where do you allocate that extra time for the developer?
What is stateful in java?
What is java lang noclassdeffounderror?
What is java bean class?
Can the main method be declared final?
Explain daemon thread.
Who is at risk in java? : java security
What is numberformatexception in java?
Why struts framework is used in java?
What is default constructor in java?