Last active
August 29, 2015 14:06
-
-
Save brianm/29fa4a635bff83bdf1dd to your computer and use it in GitHub Desktop.
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
package com.example; | |
public class Main | |
{ | |
private static int foo = 1; | |
public static void main(String[] args) throws InterruptedException | |
{ | |
new Thread(() -> foo = 2).start(); | |
new Thread(() -> foo = 3).start(); | |
new Thread(() -> System.out.println(foo)).start(); | |
new Thread(() -> System.out.println(foo)).start(); | |
Thread.sleep(1000); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment