**How do I get rid of the infinte loops pointed out?I can't use the break statement.I tried to use the if statement without a while loop , but the problem was that the last else statement won't prompt the user to re-enter a value for commande_commis ,so I resorted to the while loop ,and here i am struggling with the infinte loops **
public static void main (String[] params) {
System.out.println("hi");
char commisfalse='f' ;
char commisFalse='F';
char commistrue='t';
char commisTrue='T' ;
char commande_commis ;
//true or flse
System.out.print("want to end program?");
commande_commis=Clavier.lireChar();
//boolean
boolean commis=false;
while(commis=true){
if(commande_commis==commisfalse || commande_commis==commisFalse){
System.out.println("end"); //infinte loop
}else if(commande_commis==commistrue || commande_commis==commisTrue){
System.out.println("Welcome"); //infinte loop
} else{
System.out.println("re-enter");
commande_commis=Clavier.lireChar();
}
} }
Aucun commentaire:
Enregistrer un commentaire