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); } }

  1. 59

  2. Compile time error, because you have to do int total = ((Integer)(list.get(0))).intValue();

  3. Compile time error, because can't add primitive type in List.

  4. Compile Properly but Runtime Exception


Correct Option: A

Find more quizzes: