Facebook
From Queen Plover, 4 Years ago, written in Plain Text.
This paste is a reply to Untitled from Burly Flamingo - go back
Embed
Viewing differences between Untitled and Re: Untitled
import java.util.Arrays;
import java.util.List;
import java.util.Random;
 
public class Watek implements Runnable {
 
    private int[] tab = new int[100];
    @Override
    public void run() {
        Random r = new Random();
        for(int i = 0; i<100;i++)
        {
            tab[i] = r.nextInt((401))+100;
        }
    }
 
    public int[] getTab() {
        return tab;
    }
}
 
class Main {
 
    public static void main(String[] args) {
        Watek w1 = new Watek();
        Thread t1 = new Thread(w1);
        t1.start();
 
        try {
 
            t1.join();
 
        } catch (InterruptedException ex) {
 
        }
        new Thread(()->{
            List numbers = Arrays.asList(w1.getTab());
                numbers.forEach(System.out::println);
System.out.println(Arrays.toString(w1.getTab()));  
        }).start();
 
 
    }
 
}