Skip to content

Instantly share code, notes, and snippets.

@souenzzo

souenzzo/Main.java

Created Mar 9, 2019
Embed
What would you like to do?
Run with java --source 11 Main.java
import java.util.Objects;
public class Main {
public static void main(String[] args) {
var foo = new Object() {
String x = "aa";
};
Thread t;
t = new Thread(() -> {
if (Objects.nonNull(foo.x)) {
System.out.println("não nulo! - " + foo.x);
for (var i = 0; i < 1e7; i++) {
}
System.out.println("não nulo? - " + foo.x);
} else {
System.out.println("é null");
}
});
t.start();
for (var i = 0; i < 1e6; i++) {
}
foo.x = null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.