Suppose we have the following two class definitions.
class A { public int f(int x) { return 2 * x; } public int g(int x) { return f(x * 3); } } | class B extends A { public int f(int x) { return 5 * x; } public int h(int x) { return f(7 * x); } } |
What would the method print?public static void run() { B b = new B(); IO.println(b.f(1) + " " + b.g(1) + " " + b.h(1)); A a = b; IO.println(a.f(1) + " " + a.g(1)); }
5 15 35 5 15