Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Random;
- public class Punto1 {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- ArrayList<Integer> lista = new ArrayList<>();
- Random random = new Random();
- int aux;
- for(int i = 0; i < 10; i++) {
- aux = random.nextInt(100,200);
- try {
- Thread.sleep(aux);
- Productor prod = new Productor(lista,i);
- Consumidor cons = new Consumidor(lista,i);
- prod.start();
- cons.start();
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement