| Author |
doubt abt Generics mock question - from K&B
|
adam Lui
Ranch Hand
Joined: Sep 03, 2007
Posts: 186
|
|
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?
|
boolean b = true;<br />System.out.println ("I believe in Java.<br />Java will make my dream come " + b);
|
 |
Burkhard Hassel
Ranch Hand
Joined: Aug 25, 2006
Posts: 1274
|
|
Because Bu.
|
 |
 |
|
|
subject: doubt abt Generics mock question - from K&B
|
|
|