Javatpoint Logo
Javatpoint Logo

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

Test it Now

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

Test it Now

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

Test it Now

Output:

1. Sum = 3.4028235E38
2. Sum = NaN
3. Sum = 1.0

Next TopicJava Float





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA