posted 17 years ago
Given a method declared as:
A programmer wants to use this method like this:
Which pairs of declarations could be placed at // INSERT DECLARATIONS HERE to allow the code to compile? (Choose all that apply.)
A. ArrayList<Integer> input = null;
ArrayList<Integer> output = null;
B. ArrayList<Integer> input = null;
List<Integer> output = null;
C. ArrayList<Integer> input = null;
List<Number> output = null;
D. List<Number> input = null;
ArrayList<Integer> output = null;
E. List<Number> input = null;
List<Number> output = null;
F. List<Integer> input = null;
List<Integer> output = null;
G. None of the above.
the answers are B, E and F.
as if B is "ArrayList<Integer> input = null",
WHY would process(input) works, as the method's parameter declared as process(List<E> nums), type of List not ArrayList?