Given the code fragment:
Which action enables Computator class to compile?
Given the code fragment:
Which action enables Computator class to compile?
The return type of the sum method should be Double instead of N. The reason is that the method is processing numerical values and computing their sum. The doubleValue method returns a double, and the sum variable is also a double. Therefore, the correct return type for this method should be Double to ensure proper type handling and prevent compilation errors.
D is correct, only for safe type N extends of number but the return type is a double, even double extends from a double, Class N can be any class that extends, compilator does unknown the type so prevent this compilator error thworn. return type must be double
D is correct, Tested
return type should be Double and not N