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 1.5 introduced autoboxing, which automatically converts primitive int to Integer when needed. The statement mylist.add(5) works because the int 5 is autoboxed to Integer. The code compiles and runs without error, so the statement that it gives compilation error is false.