What is the difference between these 2 methods which work similar. Can any one explain me the exact difference?
**Accepts the list with all Number Type**
public static double sum(List<? extends Number> list)
{
double sum = 0;
for(Number n : list){
sum += n.doubleValue();
}
return sum;
}
// Accepts the list with all Number Type
public static <T extends Number> double sum1(List<T> list){
double sum = 0;
for(T n : list){
sum += n.doubleValue();
}
return sum;
}