int a=0;
                       //premiere tache
                         Timer timer1 = new Timer();
		        timer1.scheduleAtFixedRate(new TimerTask() {
		        	//utiliser la variable a qui me genere des erreurs
		            public void run()
		            {
		                System.out.println ("première tâche"+a);
		            }
		        }, 0, 1000);
		        
                       //deuxieme tache
		        Timer timer2 = new Timer();
		        timer2.schedule (new TimerTask() {
		            public synchronized void run()
		            {
                                 //utiliser la variable a qui me genere des erreurs
		                System.out.println ("deuxième tâche"+a);
		            }
		        }, 0, 1000);
                      if(a=1){ System.out.println ("première tâche"+a)}                          
                        if (a=2){ System.out.println ("deuxième tâche")}
                        // y a encore du code..
			
		
 
	
Partager