Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class Watek extends Thread {
- private Random ran = new Random();
- private static int counter = 0;
- private int num = 0;
- public Watek() {
- num = counter;
- counter++;
- }
- @Override
- public void run() {
- for(int i = 0; i<5; i++) {
- int k = ran.nextInt(900)+100;
- System.out.println("Kołodziejczyk "+num+" - "+ k );
- try {
- Thread.sleep(k);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- System.out.println("Kołodziejczyk "+num+" - ended" );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement