Double.sum(): This method is available in java.lang.Double class of java.
Syntax:
double java.lang.Double.sum(double a, double b)
This method takes two arguments of type double as its parameters. This method adds two double values together as per the + operator.
Parameters: Two parameters are required for this method.
a: the first operand.
b: the second operand.
Returns: The sum of a and b.
For Example:
double a = 1919.6, b = 9891.7
Double.sum(a,b) = > It returns 11811.300000000001
Approach
Java
public class DoubleSum {public static void main(String[] args) {double a = 1919.6, b = 9891.7;System.out.println(Double.sum(a, b));}}
Output:
11811.300000000001
No comments:
Post a Comment