When trying to receive value through JOptionPane
in an array, but gives this error:
type mismatch: cannot convert from String to String[]
How can I fix it?
Here is my source code below:
package br.deivsoft.estudo.modelo;
import javax.swing.JOptionPane;
public class TestaAnalistas {
public static void main(String[] args) {
Analistas analist = new Analistas();
analist.nome = JOptionPane.showInputDialog("Digite seu nome: ");
analist.matricula = JOptionPane.showInputDialog("Digite sua matricula: ");
analist.equipe = JOptionPane.showInputDialog("Digite sua equipe: ");
analist.demandas = new String[3][4];
for (int i = 0; i < analist.demandas.length; i++) {
analist.demandas[i] = JOptionPane.showInputDialog("Digite o nome: ");
for (int j = 0; j < analist.demandas[i].length; j++) {
analist.demandas[i][j] = JOptionPane.showInputDialog("Digite a demanda: ");
}
}
analist.exibirDadosAnalistas();
}
}
package br.deivsoft.estudo.modelo;
public class Analistas {
String nome;
String matricula;
String equipe;
String[][] demandas;
void exibirDadosAnalistas() {
System.out.println("Nome: "+nome);
System.out.println("Matricula: "+matricula);
System.out.println("Equipe: "+equipe);
for (int i = 0; i < demandas.length; i++) {
System.out.println("Analista: "+demandas[i]);
for (int j = 0; j < demandas[i].length; j++) {
System.out.println("Demanda: "+demandas[i][j]);
}
}
}
}