Multiple choice technology programming languages

public static void main(String[] args){ Integer i = new Integer(5); List myList; myList = new ArrayList(); myList.add(3); myList.add(5); myList.add(7); myList.remove(i); for(String s: myList) { System.out.println("List Value >> "+s); } } What is the output?

  1. 3,7

  2. 3,5,7

  3. index Outofbound exception

  4. Compilation fails

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

Java generics do not support primitive types like int; they require reference types like Integer. Therefore, declaring List causes a compilation failure. Additionally, iterating over myList using a String loop variable would also fail compilation.