3 public static void main(String
[] args
) {
4 final int THREADS_NUMBER
= 3;
5 Thread t
[] = new Thread
[THREADS_NUMBER
];
7 for (int i
= 0; i
< t
.length
; i
++) {
8 ThreadJob threadJob
= new ThreadJob(String
.valueOf(i
));
9 t
[i
] = new Thread(threadJob
);
13 for (int i
= 0; i
< t
.length
; i
++) {
17 catch (InterruptedException e
) {
18 // this part is executed when an exception (in this example InterruptedException) occurs
19 System
.err
.println("InterruptedException: " + e
);
22 System
.out
.println("Threads execution finished");