Use stderr where appropriate.
[TD_SR.git] / TD1 / exo2 / Main.java
1 class Main {
2
3 public static void main(String[] args) {
4 final int THREADS_NUMBER = 3;
5 Thread t[] = new Thread[THREADS_NUMBER];
6
7 for (int i = 0; i < t.length; i++) {
8 ThreadJob threadJob = new ThreadJob(String.valueOf(i));
9 t[i] = new Thread(threadJob);
10 t[i].start();
11 }
12
13 for (int i = 0; i < t.length; i++) {
14 try {
15 t[i].join();
16 }
17 catch (InterruptedException e) {
18 // this part is executed when an exception (in this example InterruptedException) occurs
19 System.err.println("InterruptedException: " + e);
20 }
21 }
22 System.out.println("Threads execution finished");
23 }
24
25 }