Java : problème de else if :-(
yserman
-
yserman -
yserman -
Salut à tous ,
voilà j'ai un problème avec des condition else if et ca commence à me .............. je vois pas ou est l'erreur j'ai tout essayer
mon code :
if (e.getSource()== rechercher)
{
String testcategorie =(String)choixcategorie.getSelectedItem();
String testmarque =(String)choixmarque.getSelectedItem();
String testref =(String)choixref.getSelectedItem();
if((testcategorie.equals("/*Choix*/"))&&(testmarque.equals("/*Choix*/")) && (testref.equals("/*Choix*/")));
{
JOptionPane.showMessageDialog(null,"Vous n'avez rien selectionné ");
}
else if ((testcategorie.equals("/*Choix*/"))&&(testmarque.equals("/*Choix*/")) && (testref.equals("/*Choix*/")==false));
{
JOptionPane.showMessageDialog(null,"ref ");
}
}
et le message d'erreur est :
GestionStock/Sortie.java [300:1] 'else' without 'if'
else if ((testcategorie.equals("/*Choix*/"))&&(testmarque.equals("/*Choix*/")) && (testref.equals("/*Choix*/")==false));
^
1 error
Errors compiling Sortie.
voilà j'ai un problème avec des condition else if et ca commence à me .............. je vois pas ou est l'erreur j'ai tout essayer
mon code :
if (e.getSource()== rechercher)
{
String testcategorie =(String)choixcategorie.getSelectedItem();
String testmarque =(String)choixmarque.getSelectedItem();
String testref =(String)choixref.getSelectedItem();
if((testcategorie.equals("/*Choix*/"))&&(testmarque.equals("/*Choix*/")) && (testref.equals("/*Choix*/")));
{
JOptionPane.showMessageDialog(null,"Vous n'avez rien selectionné ");
}
else if ((testcategorie.equals("/*Choix*/"))&&(testmarque.equals("/*Choix*/")) && (testref.equals("/*Choix*/")==false));
{
JOptionPane.showMessageDialog(null,"ref ");
}
}
et le message d'erreur est :
GestionStock/Sortie.java [300:1] 'else' without 'if'
else if ((testcategorie.equals("/*Choix*/"))&&(testmarque.equals("/*Choix*/")) && (testref.equals("/*Choix*/")==false));
^
1 error
Errors compiling Sortie.
A voir également:
- Java : problème de else if :-(
- Waptrick java football - Télécharger - Jeux vidéo
- Jeux java itel - Télécharger - Jeux vidéo
- Eclipse java - Télécharger - Langages
- Java apk - Télécharger - Langages
- Waptrick java voiture - Télécharger - Jeux vidéo
2 réponses
lol, c'est quoi ces point virgules après tes if(condition) et avant l'ouverture { ...?
Je pense que tu devrais les otez, ca permettrait en effet de marcher correctement je pense...
essai donc et di moi.
if (e.getSource()== rechercher)
{
String testcategorie =(String)choixcategorie.getSelectedItem();
String testmarque =(String)choixmarque.getSelectedItem();
String testref =(String)choixref.getSelectedItem();
if((testcategorie.equals("/*Choix*/"))&&(testmarque.equals("/*Choix*/")) && (testref.equals("/*Choix*/")))
{
JOptionPane.showMessageDialog(null,"Vous n'avez rien selectionné ");
}
else if ((testcategorie.equals("/*Choix*/"))&&(testmarque.equals("/*Choix*/")) && (testref.equals("/*Choix*/")==false))
{
JOptionPane.showMessageDialog(null,"ref ");
}
}
++
Je pense que tu devrais les otez, ca permettrait en effet de marcher correctement je pense...
essai donc et di moi.
if (e.getSource()== rechercher)
{
String testcategorie =(String)choixcategorie.getSelectedItem();
String testmarque =(String)choixmarque.getSelectedItem();
String testref =(String)choixref.getSelectedItem();
if((testcategorie.equals("/*Choix*/"))&&(testmarque.equals("/*Choix*/")) && (testref.equals("/*Choix*/")))
{
JOptionPane.showMessageDialog(null,"Vous n'avez rien selectionné ");
}
else if ((testcategorie.equals("/*Choix*/"))&&(testmarque.equals("/*Choix*/")) && (testref.equals("/*Choix*/")==false))
{
JOptionPane.showMessageDialog(null,"ref ");
}
}
++