Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to load a class programmatically?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are tlds in java?

914


What is ehcache in java?

1020


What is difference between map and flatmap in java 8?

917


How do I know if I have jre or jdk?

948


Are the actual permissions for the application defined at run-time or compile-time? : java security

997


In system.out.println(), what is system, out and println?

1056


What is the difference between lambda expression and anonymous methods?

971


What are jdk tools?

947


Is lambda expression an object?

950


What is hql in java?

934


How to reverse the singly linked list(In Node data members are(int data,int pointerTONext))

1752


Can we write lambda without functional interface?

956


How do I enable java in firefox?

1138


What does jpa mean?

953


what are the different phases in delivering the project during development and maintenance?

4674