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

How do I create an executable jar file?

1073


What is the use of flatmap?

968


Is lambda cheaper than ec2?

919


Why do we only use the main method to start a program?

1017


Is openjdk the same as jdk?

905


How do I install jdk?

870


What does @override mean in java?

949


Which is more secure: java or activex? : java security

921


Which version of jdk is required for netbeans 8.0 2?

847


What is cloning in java?

910


How can I swap two variables without using a third variable?

970


What is the point of lambda expressions?

992


Can the main method be overloaded?

957


What are anonymous methods and lambda expression?

829


What do you understand by numeric promotion?

1003