السلام عليكم ورحمة الله تعالى وبركاته
the second class
import java.util.concurrent.Semaphore;public class Threads implements Runnable{ private int tmp[][] ;// Matrice resultat private int m1[][] ; private int m2[][]; private int m3[]; //vecteur private int k=0,r;// Numero de la ligne de m1 a multiplier avec les colonnes de m2 int p=0; private Semaphore first; private String str; Threads(String str,int m1[][], int m2[][], int m3[], int tmp[][],int r,Semaphore s1) { this.m1 = m1; this.m2 = m2; this.m3 = m3; this.tmp = tmp; this.r = r; first = s1; this.str = str; } public void run() { try { while(m3[r-1]==0){ first.acquire(); while(m3[p]==1){ p++; } if(m3[p]==0){ k=p; m3[p]=1; // bool=0; System.out.println(p+" "+str ); } first.release(); Thread.sleep(30); for ( int i = 0;i < r; i++) { // Somme des produits, nous donne *un* element de tmp for (int j = 0; j < r; j++) { tmp[k] += m1[k][j] * m2[j]; System.out.print(" "+tmp[k]); } } } System.out.print("***************************"); } catch (InterruptedException e) { Thread.currentThread().interrupt(); e.printStackTrace();} }}الرجاء المساعدة وشكرا لكم جميعـــــــا