Exercises
Write two small programs demonstrating the use of
polymorphism through a method belonging to 1) an abstract class 2) an interface.
Disassemble both using javap -c and notice the difference. Benchmark both invocations and compare the results.
Extend the previous ClassLoader exercise with shell-like functionality. The program should prompt the user to enter a fully qualified classname of a class that extends the Command interface (an interface containing only one method : public void execute() ). Then it should try to load that class’s class definition using the previously written classloader. After casting to a Command the program should be able to invoke and execute polymorphically the execute() method of every classloaded class.