Guest User

Untitled

a guest
Jan 21st, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. public class Worker extends Thread{
  2. private int turn;
  3. private String word;
  4.  
  5. public Worker(int turn, String word){
  6. this.turn = turn;
  7. this.word = word;
  8. this.start();
  9. }
  10.  
  11. public void run(){
  12. while(true){
  13. if(Game.getTurn() == turn){
  14. System.out.println(word);
  15. Game.invTurn();
  16. }
  17. else
  18. this.yield();
  19. }
  20. }
  21. }
Add Comment
Please, Sign In to add comment