blob: a1dbfc714326842c24d88a31d4254c923b88ad1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import java.util.concurrent.atomic.AtomicReference;
class Test {
AtomicReference<Byte> b = new AtomicReference<Byte>((byte) 0);
void bar() {
if (b.get() == 0) {
b.getAndSet(new Byte((byte) (b.get() + 1)));
b.set(new Byte((byte) (b.get() + 0)));
//System.out.println(b + 10);
System.out.println(b.get());
}
}
}
|