Multiple choice technology web technology

Given a method declared as public static List process(List nums) A programmer wants to use this method like this // INSERT DECLARATIONS HERE output = process(input); Which pairs of declarations could be placed at // INSERT DECLARATIONS HERE to allow the code to compile? (Choose all that apply.)

  1. ArrayList<Integer> input = null; ArrayList<Integer> output = null;

  2. ArrayList<Integer> input = null; List<Integer> output = null;

  3. ArrayList<Integer> input = null; List<Number> output = null;

  4. List<Number> input = null; ArrayList<Integer> output = null;

  5. List<Number> input = null; List<Number> output = null;

  6. List<Integer> input = null; List<Integer> output = null;

Reveal answer Fill a bubble to check yourself
B,E,F Correct answer
Explanation

The method returns List where E is inferred from the type parameter of the input List. Thus, the output type must be List (or a supertype like Collection), not a concrete subtype like ArrayList. Also, the type parameter of input and output must match exactly.