Skip to content

Instantly share code, notes, and snippets.

@frhd
Created February 20, 2014 10:29
Show Gist options
  • Save frhd/9110802 to your computer and use it in GitHub Desktop.
Save frhd/9110802 to your computer and use it in GitHub Desktop.
infinite loop threading etc
public class Main {
public static volatile int x = 0;
public static void main(String[] args) {
LoopingThread t = new LoopingThread();
t.start();
while (true) {
x = x++;
}
}
}
class LoopingThread extends Thread {
public @Override void run() {
while (true) {
System.out.println(Main.x);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment