95
Java Float sum() Method
The sum() method of Java Float class returns the sum of two float arguments same as the operation performed by ‘+’ operator.
Syntax:
Parameters:
- Specifies the first argument passed
- Specifies the second argument passed
Return Value:
The sum() method returns float representing sum of a and b.
Example 1
Output:
Number I = 562.827 Number II = 900.981 Sum of two numbers = 1463.8081 Number III = -7367.76 Sum of three numbers = -5903.9517
Example 2
Output:
Enter your Marks of following subjects English : 98 Maths : 99 Science : 78 S.St : 76 Hindi : 87 Computer : 89 Your percentage = 87.833336%
Example 3
Output:
1. Sum = 3.4028235E38 2. Sum = NaN 3. Sum = 1.0
Next TopicJava Float