116
Java Double sum() Method
The sum() method of Double class returns the sum of two double arguments same as the operation performed by ‘+’ operator.
Syntax:
Parameters:
a– the first argument passed
b– the second argument passed
Return Value:
The sum() method returns the sum of a and b.
Example 1
Output:
Enter first number: 67 Enter second number: 98 Enter third number: -98 Sum = 67.0
Example 2
Output:
Enter your Marks of following subjects English : 87 Maths : 98 Science : 67 S.St : 87 Hindi : 56 Computer : 45 You got 73.33333333333333%
Next TopicJava Double