Skip to content

Instantly share code, notes, and snippets.

@mNantern
Created September 1, 2013 19:41
Show Gist options
  • Select an option

  • Save mNantern/6406771 to your computer and use it in GitHub Desktop.

Select an option

Save mNantern/6406771 to your computer and use it in GitHub Desktop.
class ThreadProcess implements Runnable {
public int count = 0;
@Override
public void run() {
for (int i = 0; i < 10; i++) {
synchronized (this) {
count++;
}
System.out.println("Thread:" +Thread.currentThread().getName()+ " Count:"+count);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment