Guest User

Untitled

a guest
Feb 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. package com.test;
  2.  
  3. import java.util.concurrent.atomic.AtomicInteger;
  4.  
  5. public class RunnableExample implements Runnable {
  6.  
  7. private AtomicInteger count = new AtomicInteger(0);
  8. @Override
  9. public void run() {
  10. System.out.println("Działanie wątku: " + Thread.currentThread().getName());
  11. count.incrementAndGet();
  12. System.out.println("Zmiana wartosci przez wątek: " + Thread.currentThread().getName());
  13. }
  14.  
  15. public int getCountValue(){
  16. return count.get();
  17. }
  18. }
Add Comment
Please, Sign In to add comment