Premièrement pour rendre ton code plus propre je te conseille vivement de faire dans tes boucles
Code:
1 2 3 4 5 6 7 8
| int nbPrenomsQ = tabPrenomQ.length
int nbPrenomsP = tabPrenomP.length
for(int i = 0; i < nbPrenomsP; i++) {
for(int j = 0; j < nbPrenomsQ; i++) {
...
}
} |
Tu éviteras de rappeller la fonction length à chaque fois.
De plus, ton
Citation:
Code:
1 2 3 4
| if(tabPrenomP[0][y]!=null && tabPrenomQ[0][z]!=null){
System.out.println(tabPrenomP[0][y]+" = "+tabPrenomQ[0][z]);
System.out.println("");
if(tabPrenomP[0][y].equals(tabPrenomQ[0][y])) |
peut être factorisé en
Code:
if(tabPrenomP[0][y] != null && tabPrenomP[0][y] == tabPrenomQ[0][Z])
Si tabPrenomQ[0][y] est null est que tabPrenomP[0][y] == tabPrenomQ[0][y]
alors tabPrenomP[0][y] est null.
Ainsi ton code aura un niveau d'indentation de moins, un appel à if en moins et un test en moins. En rouge, je pense qu'il s'agit de ton erreur ;).
Cordialement