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?



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

Post New Answer

More Java Related AllOther Interview Questions

What is difference between loosely coupled and tightly coupled in java?

0 Answers  


What do you understand by numeric promotion?

0 Answers  


What is a controller in java?

0 Answers  


how ahstraction is the property of oops,this is also in c and c++ ex. printf function which is also hide the unnecessary data,so what is the difference ? and does c++ fallow the abstraction?

0 Answers  


What's the difference between code-based security and role-based security? Which one is better? : java security

0 Answers  


What is the meaning of loosely coupled in java?

0 Answers  


What is microservices java?

0 Answers  


What is the difference between map and flatmap in java?

0 Answers  


Is jvm a compiler or an interpreter?

0 Answers  


How do I open the java console in windows 10?

0 Answers  


What if I do not provide the string array as the argument to the method?

0 Answers  


What is a yaml file in java?

0 Answers  


Categories