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 |
If one class havent the constructor, it has normal method, then can i use super keyword to call the method form the sub class and vice verse?
What is jpa entitymanager?
What is @override annotation in java?
How should I format my code? How should I comment my code?
What do I need to install netbeans?
What is web container in java?
Can I use openjdk for commercial?
Does netbeans need jdk?
Can you compile java into exe?
What is stateless object in java?
what are the steps in JDBC connectivity..???
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.