Multiple choice technology programming languages

What will be output of following code? 1 public class Main { 2 public static void main(String[] args) { 3 short a = 22; 4 execute(3); 5 System.out.println(a); 6 } 7 8 static void execute(short s){ 9 s = 33; 10 } 11 }

  1. Compile time error at line 3

  2. Compile time error at line 4

  3. 22

  4. None of above

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

Method execute expects short parameter. Literal 3 is int by default. Java does NOT implicitly narrow int to short for method calls. Must call with (short)3 or pass short variable.