Salut comment je peu exécute ce thread en mode synchronized ?
Merci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
public class ProTherad extends Thread {
	protected int count;
	protected int inc;
	protected int delai;
 
	 public ProTherad( int count ,int inc ,int delai){// constructeur
		this.count=count;
		this.inc=inc;
		this.delai=delai;
													}
	public void run(){
		try{
 
		for(;;){
			System.out.println(count + "   ");
			count+=inc;
			sleep(delai);}
			}catch(InterruptedException e){}
				}
 
 
			}
et

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
public class Appli {
 
	public static void main(String[] args) {
	ProTherad thread1,thread2;
		thread1 = new ProTherad(0,1,33);
		thread2 = new ProTherad(33,1,66);
		thread1.start();
		thread2.start();
 
 
	}				
 
 
}