Multiple choice technology web technology

Given: public static void main(String[] args) { // INSERT DECLARATION HERE for (int i = 0; i <= 10; i++) { List row = new ArrayList(); for (int j = 0; j <= 10; j++) row.add(i * j); table.add(row); } for (List row : table) System.out.println(row); } Which statements could be inserted at // INSERT DECLARATION HERE to allow this code to compile and run? (Choose all that apply.)

  1. List<List<Integer>> table = new List<List<Integer>>();

  2. List<List<Integer>> table = new ArrayList<List<Integer>>();

  3. List<List<Integer>> table = new ArrayList<ArrayList<Integer>>();

  4. List<List, Integer> table = new List<List, Integer>();

  5. List<List, Integer> table = new ArrayList<List, Integer>();

  6. List<List, Integer> table = new ArrayList<ArrayList, Integer>();

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

The code creates a 2D table using nested loops, so table must be a List of List. Option B correctly declares List> table = new ArrayList>() - ArrayList implements List, and the generic type matches. Option A fails because List is an interface and cannot be instantiated. Option C fails because ArrayList> cannot be assigned to List> - the inner generic type must match exactly. Options D-F use invalid syntax with commas instead of proper generic notation.