What is the purpose of `VarHandle` introduced in Java 9?

Java Professional Hard

Java Professional — Hard

What is the purpose of `VarHandle` introduced in Java 9?

Key points

  • `VarHandle` offers fine-grained memory ordering semantics
  • It allows for safe concurrent access to variables
  • It is a safer alternative to using `Unsafe` directly

Ready to go further?

Related questions