Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.test;
- import java.util.concurrent.atomic.AtomicInteger;
- public class RunnableExample implements Runnable {
- private AtomicInteger count = new AtomicInteger(0);
- @Override
- public void run() {
- System.out.println("Działanie wątku: " + Thread.currentThread().getName());
- count.incrementAndGet();
- System.out.println("Zmiana wartosci przez wątek: " + Thread.currentThread().getName());
- }
- public int getCountValue(){
- return count.get();
- }
- }
Add Comment
Please, Sign In to add comment