Java AtomicInteger lazySet() method

The lazySet() method of Java AtomicInteger class will atomically update the given atomicinteger with newValue.

Syntax

Parameters

This method will take the argument which we want to give to the atomicinteger.

Example 1

Test it Now

Output:

the  new number is: 100

Example 2

Test it Now

Output:

the  new number is: 12

Example 3

Test it Now

Output:

the  new number is: 100

Example 4

Test it Now

Output:

the  new number is: 0

Example 5

Test it Now

Output:

the  new number is: -10





Latest Courses