Java Float sum() MethodThe sum() method of Java Float class returns the sum of two float arguments same as the operation performed by '+' operator. Syntax:Parameters:
Return Value:The sum() method returns float representing sum of a and b. Example 1Test it NowOutput: 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 2Test it NowOutput: Enter your Marks of following subjects English : 98 Maths : 99 Science : 78 S.St : 76 Hindi : 87 Computer : 89 Your percentage = 87.833336% Example 3Test it NowOutput: 1. Sum = 3.4028235E38 2. Sum = NaN 3. Sum = 1.0
Next TopicJava Float
|