Exam 1z0-819 All QuestionsBrowse all questions from this exam
Question 39

Given the code fragment:

Which action enables Computator class to compile?

    Correct Answer: D

    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.

Discussion
d7bb0b2Option: D

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

StavokOption: D

D is correct, Tested

RP384Option: D

return type should be Double and not N