Java AtomicInteger set() method

The set() method of Java AtomicInteger sets the atomicinteger value to the given value.

Syntax

Parameters

It is the new value.

Return

It does not return any value.

Example 1

Test it Now

Output:

the  new value is:100

Example 2

Test it Now

Output:

the  new value is:1

Example 3

Test it Now

Output:

the  new value is:10

Example 4

Test it Now

Output:

the  new value is:0

Example 5

Test it Now

Output:

the  new value is:-10





Latest Courses