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 if I write static public void instead of public static void?

851


What is a dao layer in java?

867


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

1007


Are jvm’s platform independent?

888


What is cache in java?

902


What is mime in java?

883


What is injection in java?

917


Why sun introduce concept of anonymous class? What is need and real life use of anonymous class

2193


What is meant by annotation in java?

964


Why do we need new date and time api in java se 8?

878


What is lambda expression in mvc?

994


What is the difference between collection and stream?

921


How do I create an executable jar file?

1060


What is csrf in java?

955


Why do we create dto in java?

926