Multiple choice technology testing

Which of the following two functions will be invoked when the function call given is---- show(10,10);

  1. show(long a,byte b){ }

  2. show(byte b, long a){ }

  3. runtime exception

  4. none of the above

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

In Java, calling show(10, 10) passing two integer literals (int) requires implicit promotions. Both show(long, byte) and show(byte, long) would require one promotion to long and one demotion/narrowing to byte, which is invalid without casting. Hence, it causes a compile-time ambiguity or error, matching none of the above options.