Question: Consider the following Java interface and class definitions: public interface X { int getX(): } public interface U { int getY(): } class C implements

 Consider the following Java interface and class definitions: public interface X

Consider the following Java interface and class definitions: public interface X { int getX(): } public interface U { int getY(): } class C implements X { public int getX() { return 1: } } class D extends C implements Y { public int getX () { return 2: } public int getY() { return getX() + getx(): } class E extends C { public int getY() { return 3: } } For each code snippet below, what value that will be printed out D d1 = new D(): System.out.println (d1.getY()): a. 3 b. 9 c. 4 d. none of the above Answer: C c1 = new D(): System.out.printin (cl.getX()): a. 2 b. 3 c. 1 d. None of the above Answer: X x1 = new C(): System.out.printin(x1.getX()): a. 5 b. 1 c. 0 d. None of the above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!