The sum() method of Java Integer class add the two specified integers values. It returns the same result as given by + operator.

Syntax

public static int sum (int a, int b)

 Parameters

The parameters ‘a’ and ‘b’ represent the first and second operands.

 Return Value

This method returns the sum of ‘a’ and ‘b’.

Example 1

Output

Example 2

Output

Example 3

Output

Pin It on Pinterest

Share This