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 type of parameter passing does java support?
i have client interview in TCS.client is CITI BANK.how to face it,what type of questions they will ask,please tell send me to kumar525job@gmail.com
Why bean class is used in java?
What is dto layer in java?
In an htm form i have a button which makes us to open another page in 15sec.how will you do that?
What is difference between map and flatmap in java 8?
What is the use of jprofiler?
What is native api in java?
What does persist mean in java?
What is jep in java?
What are messages in java?
What is contextpath in java?