1
While recovering data from an arraylist by means of the "for" command, it displays the following message:
Note: I could not identify where the error is. What do you think is wrong?
package listatelefonica;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
public class Principal {
public static void main(String[] args) {
List<Contato> contatos = new ArrayList<Contato>();
String nome, telefone, email, opcao = null;
do{
nome = JOptionPane.showInputDialog(null,"Informe o nome:");
telefone = JOptionPane.showInputDialog(null,"Informe o telefone:");
email = JOptionPane.showInputDialog(null,"Informe o email:");
Contato contato = new Contato(nome,telefone,email);
contatos.add(contato);
opcao = JOptionPane.showInputDialog(null,"Digite N para criar um novo contato ou outra tecla para encerrar:");
} while (opcao.toUpperCase().equals("N"));
for (Contato umContato : contatos){
JOptionPane.showMessageDialog(null, umContato);
}
}
}
It would be interesting to add the error in text form too, sometimes some people who could help you, may not be able to view the image, by some kind of restriction.
– user28595
What you want to show in Optionpane?
– Jéf Bueno