r/programminghorror • u/vinzzii • Nov 04 '26
Can you find it???
public class VisibilityPuzzle {
private static boolean ready = false;
private static int number = 0;
private static class ReaderThread extends Thread {
public void run() {
while (!ready) {
Thread.yield();
}
System.out.println("Result: " + number);
}
}
public static void main(String\[\] args) throws InterruptedException {
new ReaderThread().start();
number = 42;
ready = true;
}
}
0
Upvotes
2
u/Sh3llSh0cker Nov 04 '26
wrong sub bud.
2
u/MurkyWar2756 echo "Sub Mod" && :(){ :|:& };: 29d ago
Why isn't this in a code block?
-1
u/Puzzlehead_NoCap Nov 04 '26
Just ask ChatGPT. No need to think anymore