Skip to content

Instantly share code, notes, and snippets.

@Maccimo
Created October 7, 2021 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Maccimo/cc8e2ab121eaeca9a8e891c46a143939 to your computer and use it in GitHub Desktop.
Save Maccimo/cc8e2ab121eaeca9a8e891c46a143939 to your computer and use it in GitHub Desktop.
JDK-8273914 bug demo.
/**
* Sample from https://habr.com/ru/post/581576/ article.
*/
import java.util.concurrent.atomic.AtomicInteger;
public class Disturbed {
public static void main(String... args) {
AtomicInteger counter = new AtomicInteger(1);
System.out.println(
"First two positive numbers: " +
counter +
", " +
counter.incrementAndGet()
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment