We know that i is non-atomic, so is i=i 1 also non-atomic?
ringa_lee
From a java perspective, yes. Moreover, i++ is also atomic.
i++
i = i + 1 Non-atomic, if you want atomicity, please use AtomicInteger
i = i + 1
From a java perspective, yes. Moreover,
i++
is also atomic.i = i + 1
Non-atomic, if you want atomicity, please use AtomicInteger