Writing Methods

AP Computer Science A· difficulty 4/5

Given <code>print(int x)</code> and <code>print(double x)</code>, calling <code>print(5)</code> invokes

  • A

    Both

  • B

    Compile error (ambiguous)

  • C

    print(int)

    check_circle
  • D

    print(double)

Explanation

Most-specific match wins; 5 is int.

Want 10 more like this — adaptive to your weak spots?

Related questions