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 is the difference between Logical Parallelism and Physical Parallelism?
What is the current code for the Java 5 code class Root { ?
Do I need jdk or jre?
What's the difference between code-based security and role-based security? Which one is better? : java security
What is the difference between jar and executable jar?
Are jvm’s platform independent?
How do I open my java console?
What is dao in java?
What is property file in java?
What is stateless object in java?
What is setstring method in java?
there are 67 seats in train . there are only 5 seats in a row and in last row there are only 2 seats. One person can reseve only 5 seat at a time. If person reserving seat , the care is atken that he may get all in row. if seats are not available in row then the arrangement is so that person group get nearby seats. the following class is given public class seat { char name; int seat; boolean isSeatempty } 1.Draw require class digram and object diagram. 2.Write function seatallot(int noofperson) to allocate seat with seat nuber printed for the each name.