SHARE
TWEET

Untitled

a guest Sep 20th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package br.com.threadsjava;
  2.  
  3. /**
  4.  *
  5.  * @author giuliana.bezerra
  6.  *
  7.  */
  8. public class CounterTask implements Runnable {
  9.  private int counter;
  10.  
  11.  @Override
  12.  public void run() {
  13.   synchronized (this) {
  14.    counter++;
  15.    System.out.println(Thread.currentThread().getName() + ": " + counter);
  16.   }
  17.  }
  18.  
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top