Multiple choice technology programming languages

List mylist = new ArrayList(); mylist.add(5); If you compile this lines in JAVA 1.5 , it will give compilation error.

  1. True

  2. False

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

Java 5 introduced autoboxing, which automatically converts primitive int to Integer when adding to a List. The code compiles without error because the compiler handles the conversion from primitive 5 to Integer object automatically.