nerdexam
Oracle

1Z0-819 · Question #194

Given: ``java public class GameObject { public GameObject() {} public GameObject(int x, int y) { System.out.println("move(" + x + "," + y + ")"); } public Integer move(Integer x, Integer y) { return…

The correct answer is A. move(10,10) Avatar 100. See the full explanation below for the reasoning.

Question

Given: ```java public class GameObject { public GameObject() {} public GameObject(int x, int y) { System.out.println("move(" + x + "," + y + ")"); } public Integer move(Integer x, Integer y) { return new Integer(x * y); } } public class Avatar extends GameObject { public Avatar() { System.out.println("Avatar"); } public Avatar(int x, int y) { super(x, y); } public Integer move(Number x, Number y) { return super.move(x.intValue(), y.intValue()); } public static void main(String... args) { GameObject object = new GameObject(10, 10); Character character = new Character(); object.move(10, 10); character.move(10.0, 10.0); character.move(10, 10); } }
What is the result?

Options

  • Amove(10,10) Avatar 100
  • BMove GameObject Move GameObject Move GameObject
  • CMove GameObject Move GameObject Move GameObject
  • DMove GameObject Move GameObject Move GameObject

How the community answered

(47 responses)
  • A
    72% (34)
  • B
    15% (7)
  • C
    9% (4)
  • D
    4% (2)

Community Discussion

No community discussion yet for this question.

Full 1Z0-819 Practice