I'm not sure how to get something like this to appear when I run:
Thread1 is running task 1
The main (parent) thread has finished its execution
Hilo1 is running task 2
Hilo1 is executing task 3
Hilo2 is running the task 1
Hilo1 is running the task 4
Thread1 is running task 5
Hilo2 is running the task 2
Hilo1 is running the task 6
Hilo2 is running task 3
Hilo1 is running the task 7
Hilo2 is running the task 4
Hilo1 is executing task 8
Hilo2 is running the task 5
Hilo1 is running the task 9
Hilo1 is running the task 10
Hilo1 has completed its execution
Hilo2 is running the task 6
Hilo2 is running the task 7
Hilo2 is executing task 8
Hilo2 is running the task 9
Hilo2 is executing task 10
I have this structure but I'm not sure how to implement it.
public class Principal {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
HilosVarios hilo1 = new HilosVarios();
HilosVarios2 hilo2 = new HilosVarios2(hilo1);
hilo1.start();
hilo2.start();
System.out.println("Terminadas las tareas");
}
}