Multiple choice technology programming languages

What will be output for the following program? public class BoxingTest { public static void main(String[] args) { byte b = 10; method(b); } static void method(int i){ System.out.println("Primitive Type call"); } static void method(Integer i){ System.out.println("Wrapper Type Call"); } }

  1. Wrapper Type Call

  2. Primitive Type Call

  3. Compiler Error

  4. Compiles fine, throws runtime exception

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

When a byte is passed to overloaded methods accepting int and Integer, Java chooses primitive widening (byte to int) over autoboxing. The method(int i) version is called.