Question: Consider the following Java interface and class definitions, below. What is printed after running class D2. public interface X{ int getxo; } class C2 implements


Consider the following Java interface and class definitions, below. What is printed after running class D2. public interface X{ int getxo; } class C2 implements X{ public int getX() { return 5; } public int getyo { return getX() + getxO; } } class D2 extends C2 { public int getX() { return 3; } public int getwo { return 7; } public static void main(String[] args) { X x1 = new C20; public static void main(String[] args) { X x1 = new C20; System.out.println(x1.getX(); } } a. 5 b. 10 c. 7 d. 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
