-
What is the output of this program?
import java.util.*;
public class Result
{
public static double sumOfList(List extends Number> list)
{
double var = 0.0;
for (Number num : list)
var += num.doubleValue();
return var;
}
public static void main(String args[])
{
Listobj = Arrays.asList(4.3, 5.6, 7.8);
System.out.println(sumOfList(obj));
}
}
-
- 17.7
- 4.3
- 5.6
- 7.8
- None of these
Correct Option: A
17.7