CASE 01:
public static void processNumber(List<Number> nums){
}
If the method is invoked as below, compiler gives error.
processNumber(new ArrayList<Float>());
CASE 02 :
But on the contrary if we have below method. Here <Number>
is specified as type parameter
public static <Number> void processNumber(List<Number> nums){
^^^^^^^^
}
then the below invocation not giving any error...
processNumber(new ArrayList<Float>());
Why is that so?In one case it is giving error and in another, no error..why?