I have two Thread class. buyThread and sellThread .Inside the tester program, I need to declare and create 2 threads object belong to buyThread and sellThread, and do a run and join threads.
Thread bt[] = new Thread[2]; // declare and create 2 threads object
    Thread st[] = new Thread[2]; // declare and create 2 threads object
    for (int i = 0; i < 2; i++) {
        bt[i] = new BuyThread(rand1, rand2, stock);
        bt[i].start();
    }
    for (int i = 0; i < 2; i++) {
        st[i] = new SellThread(rand1, rand2, stock);
        st[i].start();
    }
    for (int i = 0; i < 2; i++) // Can I do it this way for each Thread ?
    {
        try {
            bt[i].join();
        } catch (InterruptedException e) {
        }
    }
    for (int i = 0; i < 2; i++) {
        try {
            st[i].join();
        } catch (InterruptedException e) {
        }
    }
 
     
     
    