Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package br.com.threadsjava;
- /**
- *
- * @author giuliana.bezerra
- *
- */
- public class CounterTask implements Runnable {
- private int counter;
- @Override
- public void run() {
- synchronized (this) {
- counter++;
- System.out.println(Thread.currentThread().getName() + ": " + counter);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement