Predict the output of this program:
import java.util.*; public class Main { public static void main(String []args) { List<int> intList = new ArrayList<>(); intList.add(10);/* w w w.j av a2 s . c o m*/ intList.add(20); System.out.println("The list is: " + intList); } }
C.
You cannot specify primitive types along with generics, so List<int> needs to be changed to List<Integer>.