多线程学习三十:Atomic_getatomiclong addandget 与 incrementandget-CSDN博客

网站介绍:文章浏览阅读266次。常用API常见原子类:AtomicInteger、AtomicBoolean、AtomicLong构造方法:public AtomicInteger():初始化一个默认值为0的原子型Integerpublic AtomicInteger(int initialValue):初始化一个指定值的原子型Integer常用方法://测试 incrementAndGet(),getAndIncrement(),getAndAdd,addAndGet方法 AtomicInteger integer = n_getatomiclong addandget 与 incrementandget