What is the output for the below code ? public class Test { public static void main(String[] args) { List list = new ArrayList(); list.add(0, 59); int total = list.get(0); System.out.println(total); } }
59
Compile time error, because you have to do int total = ((Integer)(list.get(0))).intValue();
Compile time error, because can't add primitive type in List.
Compile Properly but Runtime Exception