Code Java qui ne compile pas
salut filles et garçons programmeurs
je suis nouveau dans la programmation en java et pendant mon apprentissage, j'ai eu à faire ce programme mais ce pendant ma machine ne le compile pas
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| import java.util.*;
public class Boucle
{
public static void main(String[] args)
{
String prenom;
char reponse='O';
Scanner sc=new Scanner(System.in);
while (reponse=='0')
{
System.out.println("Donner un prénom:");
prenom=sc.nextline();
System.out.println("Bonjour" +prenom);
System.out.println("Voulez-vous reessayer?? (O/N)");
reponse=sc.nextline().chartAt(0);
}
System.out.println("Au revoir......");
}
} |
voici les erreurs qu'elle m'affiche:
Citation:
Boucle.java:19: cannot find symbol
symbol : method nextline()
location: class java.util.Scanner
prenom=sc.nextline();
^
Boucle.java:22: cannot find symbol
symbol : method nextline()
location: class java.util.Scanner
reponse=sc.nextline().chartAt(0);
^
2 errors
Aidez moi à comprendre ce qui ne va pas svp