Created
February 20, 2014 10:29
-
-
Save frhd/9110802 to your computer and use it in GitHub Desktop.
infinite loop threading etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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