Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which of these method calls does NOT exist on AtomicInteger?

  • A.synchronizedGet()
  • B.incrementAndGet()
  • C.compareAndSet(int, int)
  • D.getAndAdd(int)

Answer: A

There is no synchronizedGet: the class achieves its guarantees with compare-and-swap instructions rather than with monitors, which is the point of the atomic types. incrementAndGet, compareAndSet and getAndAdd are all genuine members.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.