0
Matriz Principal:
public static String [][] matrizPrincipal(){
String [] [] matriz = new String [2] [6];
matriz[0][0] = "Robin Arryn";
matriz[0][1] = "Lino Facioli";
matriz[0][2] = "145";
matriz[0][3] = "Vivo";
matriz[0][4] = "Arryn";
matriz[0][5] = "Feminino";
matriz[1][0] = "Yohn Royce";
matriz[1][1] = "Rupert Vansittart";
matriz[1][2] = "45";
matriz[1][3] = "Vivo";
matriz[1][4] = "Arryn";
matriz[1][5] = "Feminino";
return matriz;
}
Method that selects the names of the characters that are Female and are in the Arryn family:
public static String imprimeMatrizFeminina(String [] [] mat){
int cont = 0;
for(int i=0; i<mat.length; i++){
if(mat[i][5].equals("Feminino") && mat[i][4].equals("Arryn")) cont ++;
}
String[] matrizFemininaArryn = new String [cont];
for(int i=0; i<mat.length; i++){
if(mat[i][5].equals("Feminino") && mat[i][4].equals("Arryn")) matrizFemininaArryn[i] = mat[i][0];
System.out.println("Mulheres da família Arryn:" + Arrays.toString(matrizFemininaArryn));
}
return "";
}
Part of the main that calls this method:
case 6:
String matrizMulheres = imprimeMatrizFeminina(mat);
System.out.println(matrizMulheres);
break;
Can anyone tell me why this is happening?
The second impression is correct, but because the first?
DETAIL: I will have to make an impression for each family in the same method, so I am not using Return. That is, all Feminine, separated by families.
Mark the V below the answer voting field. This will indicate that this answer solves the problem.
– Fagner Fonseca