Instructions aprés thread
Bonjour,
J'aimerais exécuter des instructions après qu'un thread se soit exécuter. J'ai donc fait un petit test :
Code:
1 2 3 4 5 6 7 8 9 10
| class test
{
public static void main (String[] args)
{
System.out.println("Debut");
Thread t1 = new monThread();
t1.start();
System.out.println("Fin");
}
} |
Code:
1 2 3 4 5 6 7 8 9 10
| class monThread extends Thread
{
public void run()
{
for (int i = 0; i<= 5; i++)
{
System.out.println(i);
}
}
} |
ce qui m'affiche:
Code:
1 2 3 4 5 6 7 8
| Debut
Fin
0
1
2
3
4
5 |
Or j'aurais bien voulu que le message "Fin" s'affiche après le "5". Voyez vous ce que je veux dire?