0
Java masters, I am learning about matrices, vectors and I would like to know what happens to my code, because I create a matrix to receive six names and six positions for the employees matrix. Only when printing, I only printed the positions and it is not printing the names. It follows below the code:
public static void main(String[] args) {
//Criando o Array vetor do tipo String com seis posições
String funcionarios[][] = new String[6][1];
//Populando o array vetor
for(int nome = 0; nome <= 5; nome++)
{
String entrada = JOptionPane.showInputDialog(null, "Digite o Nome do Funcionário: ");
for(int cargo = 0; cargo <= 0; cargo++)
{
entrada = JOptionPane.showInputDialog(null, "Digite o Cargo do Funcionário: ");
funcionarios[nome][cargo] = entrada;
}
}
for(int nome = 0; nome <= 5; nome++)
//Imprimindo o conteúdo do array vetor
{
//JOptionPane.showMessageDialog(null, "Nome do Funcionario " + funcionarios[nome][cargo]);
for(int cargo = 0; cargo <= 0; cargo++)
{
JOptionPane.showMessageDialog(null, "Cargo do Funcionario " + funcionarios[nome][cargo]);
}
}
//Encerrando o sistema
System.exit(0);
Anyone who can help me, I thank you beforehand.
I would like to thank you very much, for the didactic explanation, helped me a lot, very grateful even for the help.
– Montesuma
Dispose friend! If the answer managed to help you, accept it as a response just click on the visa below the polling arrows.
– Laerte