Java AtomicInteger lazySet() 方法

2025年3月20日 | 阅读时长1分钟

Java AtomicInteger 类的 lazySet() 方法将原子地将给定的 atomicinteger 更新为 newValue。

语法

参数

此方法将接收我们想要传递给 atomicinteger 的参数。

示例 1

输出

the  new number is: 100

示例 2

输出

the  new number is: 12

示例 3

输出

the  new number is: 100

示例 4

输出

the  new number is: 0

示例 5

输出

the  new number is: -10
 
下一主题Java AtomicInteger