OOP Homework 2 --- Due 11/14 before class Please email your solutions to Anupam Nandan at anupam.nandan@nyu.edu. Be sure to use "OOP HW1 Solution" as the subject line. Consider the following Java program: public class Base { public void m(Object o) { System.out.println("Base.m(Object)"); } public static void m(String s) { System.out.println("Base.m(String)"); } public void m(Class c) { System.out.println("Base.m(Class)"); } } public class Derived extends Base { public void m(Object o) { System.out.println("Derived.m(Object)"); } public static void m(String s) { System.out.println("Derived.m(String)"); } public static void main(String[] args) { Base b = new Derived(); b.m(new Object()); b.m(new Integer(5)); b.m("Hello"); b.m(b.getClass()); } } Assignment 1 (5 Points): What is the static type of b in Derived.main()? The static type of b is Base. Assignment 2 (5 Points): What is the dynamic type of b in Derived.main()? The dynamic type of b is Derived because b is assigned only once when it is initialized and the assigned values is a newly created object of type Derived. Assignment 3 (20 Points): What are the correctly ordered entries in Derived's vtable for our translator? Please use "classname.methodname(typenames)" notation. Also, ignore the first entry, which is __isa. The order of the entries is as follows: Object.hashCode(Derived) Object.equals(Derived, Object) Object.getClass(Derived) Object.toString(Derived) Derived.m(Derived, Object) Base.m(Derived, Class) Important points: - The first parameter of each entry is the implicit __this parameter, which is of type Derived because we are describing the vtable of class Derived. - The order of the entries must be compatible with the order of the entries in the vtables of the super classes Base and Object. In particular, the overriden method Derived.m(Derived, Object) comes before the inherited method Base.m(Derived, Class). - The methods Base.m(String s) respectively Derived.m(String s) are not part of the vtable since they are declared static.