I have two variables :
int trabalhadorFormal;
int dispensadoIndireta;
And I'm using JOptionPane.showConfirmDialog with YES and NO option with those two variables.
I have the follow code :
if (trabalhadorFormal == JOptionPane.YES_OPTION) {
if (dispensadoIndireta == JOptionPane.NO_OPTION) {
do {
opcao = Integer.parseInt(JOptionPane.showInputDialog("[1] - É empregado doméstico" +
"\n[2] - Não é empregado doméstico"));
switch (opcao) {
case 1:
JOptionPane.showMessageDialog(null, "É empregado doméstico!");
break;
case 2:
JOptionPane.showMessageDialog(null, "Não é, oxeeee!");
break;
default:
JOptionPane.showMessageDialog(null, "Opção inválida!");
break;
}
} while (opcao != 1 && opcao != 2);
} else {
JOptionPane.showMessageDialog(null, "Teste!");
}
The problem is that if both ifs are selected YES on the options and goes to the else, the program simply shuts down and says that it went successful. What it's the problem here that doesn't go to the else ?
Aucun commentaire:
Enregistrer un commentaire