Skip to content

Instantly share code, notes, and snippets.

@brianm
Last active August 29, 2015 14:06
Show Gist options
  • Save brianm/29fa4a635bff83bdf1dd to your computer and use it in GitHub Desktop.
Save brianm/29fa4a635bff83bdf1dd to your computer and use it in GitHub Desktop.
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