Java AtomicLong addAndGet() Method

The addAndGet() method of Java AtomicLong class adds a number to the AtomicLong and returns its value after the addition.

Syntax

Parameters

delta - The value to add.

Return value

The updated value.

Example 1

Test it Now

Output:

10

Example 2

Test it Now

Output:

20

Example 3

Test it Now

Output:

5

Example 4

Test it Now

Output:

-40

Next TopicJava AtomicLong




Latest Courses