Question: Consider the following Java code: interface I ( int fO int 8O: abstract class C implements I ( public int fO I return 3; class
Consider the following Java code: interface I ( int fO int 8O: abstract class C implements I ( public int fO I return 3; class D extends c publc int fo (return 7: 1 public int g0 (return tO 5 auper. ro class E extends D ( public int f0 (return 11: class F extends E ( publie int fO ( return fO: /.. in some other class, perhaps in mainO final Ix new DO: System. out. println (x. gO): final 1 y " new EO ; System. out, printin (y.g0); a) 1 What does this code print? (the two system out. printino's) b) 1 What are the static (compile-time) and dynamic (runtime) tvpes of x? Static: Dynamic: c) 1 What are the static and dynamic types of y? Static: Dynamic: d) 1 In the context of the code above, what happens when you evaluate the expression new FO.fO (this is legitimate "method chaining")? If there is any problem, what causes it
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
