Question: What is the output of the following code?
1 import java.util.*;
2 public class Products {
3 private class Item<T> {}
4 Map<Map<String, String>, Map<String, Set<Item<T>>>> products = new HashMap<>();
5 public static void main(String...args) {
6 Products pds = new Products();
7 pds.test();
8 }
9 private void test() {
10 HashMap<String, String> a = new HashMap<>();
11 a.put("1","2");
12 HashMap<String, Set<Item<String>>> b = new HashMap<>();
13 Set<Item<String>> l = new HashSet<>();
14 l.add(new Item<String>());l.add(new Item<String>());
15 b.put("sports",l);
16 products.put(a,b);
17 System.out.println(products.get(a).get("sports").size());
18 }
19 }
Choice:
A. 2
B. 1
C. compile error at line 3
D. compile error at line 4
E. compile error at line 12
F. compile error at line 13
G. compile error at other lines
H. code compile but throws exception at runtime