1.

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[])
{
List obj = Arrays.asList(4.3, 5.6, 7.8);
System.out.println(sumOfList(obj));
}
}

A. 17.7
B. 4.3
C. 5.6
D. 7.8
E. None of these
Answer» B. 4.3


Discussion

No Comment Found

Related MCQs