Question: Which statement about the Elephant program is correct? A. It compiles and prints 6. B. The code does not compile because of line k1. C.
Which statement about the Elephant program is correct?

A. It compiles and prints 6.
B. The code does not compile because of line k1.
C. The code does not compile because of line k2.
D. The code does not compile because of line k3.
E. The code does not compile because of line k4.
F. None of the above.
package stampede; interface Long { Number length(); } public class Elephant { public class Trunk implements Long { public Number length() { return 6; } } } public class MyTrunk extends Trunk { // k2 public Integer length() { return 9; } // k3 // k1 } public static void charge() { System.out.print(new MyTrunk().length()); } public static void main(String[] cute) { new Elephant ().charge(); } // k4
Step by Step Solution
3.38 Rating (160 Votes )
There are 3 Steps involved in it
To determine which statement is correct about the Elephant program lets review each part of the code provided Line k1 public Number length return 6 Th... View full answer
Get step-by-step solutions from verified subject matter experts
