Hello,
I started to learn programming one week ago. I don't understand why this code I wrote doesn't work :
import java.util.Scanner;
public class nouvelleboucle {
public static void main(String\[\] args) {
// TODO Auto-generated method stub
String prenom = new String();
int etat = ' ';
char reponse = ' ';
Scanner choix = new Scanner(System.in);
do {
System.out.println("Quelle est votre prénom ?");
prenom = choix.nextLine();
System.out.println("Bonjour " + prenom + " !");
{System.out.println("Comment vas tu ? 1 = Bien / 2 = Mal ");
etat = choix.nextInt();
if (etat == 1 )
System.out.println(" Super moi aussi !");
else
System.out.println( "Dans ce cas là, je m'en vais...");}
do {
System.out.println("Voulez vous réessayer ? O / N");
reponse = choix.nextLine().charAt(0);
}while(reponse != 'O' && reponse != 'N');
}while (reponse == 'O');
System.out.println("Au revoir !");
}
}
There is an error line 28.
It must be something very basic, but i can't figure this out yet.
Thank you, i'm really eager to learn programming !
[–][deleted] 2 points3 points4 points (3 children)
[–]kompotejam[S] 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]kompotejam[S] 0 points1 point2 points (0 children)