4. public class Frodo extends Hobbit {
5. public static void main(
String[] args) {
6. Short myGold = 7;
7. System.out.println(countGold(myGold, 6));
8. }
9. }
10. class Hobbit {
11. int countGold(int x, int y) { return x + y; }
12. }
What is the result?
A. 13
B. Compilation fails due to multiple errors
C. Compilation fails due to an error on line 6
D. Compilation fails due to an error on line 7
E. Compilation fails due to an error on line 11
Answer:
D is correct. The Short myGold is autoboxed correctly, but the countGold() method
cannot be invoked from a static context.
please explain this