Java-Unresolved compilation problem:
domxaline
-
domxaline -
domxaline -
Bonjour,
voilà j'ecris le programme suivant
dans le phrase
dans le phrase
en compilant mon programme j'ai un message
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method nextString() is undefined for the type Scanner
at Mypackage.exercjavascanne.main(exercjavascanne.java:10)
(exercjavascanne.java:10) String nom=sc.nextString();
veuillez m'aidez s'il vous plaît
voilà j'ecris le programme suivant
package Mypackage;
import java.util.Scanner;
public class exercjavascanne
{
public static void main(String[]args)
{
String[]tab={"Simon","Chris","David","Sarko","Sego","Hardy","Patrick","Franck","Samir"};
Scanner sc=new Scanner(System.in);
System.out.print("Entrez un nom:");
String nom=sc.nextString();
String reponse="Ce nom ne se trouve pas dans notre system";
for(int i=0;i<tab.length;i++)
if(tab[i].equals(nom))
{
reponse="Ce nom se trouve dans notre system;";
break;
}
}
System.out.print(reponse);
}
dans le phrase
String nom=sc.nextString();//next string souligné
dans le phrase
System.out.print(reponse);//.out et reponse souligné
en compilant mon programme j'ai un message
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The method nextString() is undefined for the type Scanner
at Mypackage.exercjavascanne.main(exercjavascanne.java:10)
(exercjavascanne.java:10) String nom=sc.nextString();
veuillez m'aidez s'il vous plaît
A voir également:
- Java-Unresolved compilation problem:
- Jeux java itel - Télécharger - Jeux vidéo
- Waptrick java football - Télécharger - Jeux vidéo
- Waptrick java voiture - Télécharger - Jeux vidéo
- Java apk - Télécharger - Langages
- Eclipse java - Télécharger - Langages
8 réponses
j'ai changé nextString pour nextLine,ligne rouge est parti et compilé
maintenant j'ai message suivant
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at Mypackage.exercjavascanne.main(exercjavascanne.java:5)
(exercjavascanne.java:5)//public static void main(String[]args)
System.out.print(reponse);
.out et reponse toujours souligné
maintenant j'ai message suivant
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
at Mypackage.exercjavascanne.main(exercjavascanne.java:5)
(exercjavascanne.java:5)//public static void main(String[]args)
System.out.print(reponse);
.out et reponse toujours souligné
j'ai corrigé mon programme ainsi:
maintenant dans la ligne:
println souligné
package Mypackage;
import java.util.Scanner;
public class exercjavascanne
{
public static void main(String[]args)
{
String[]tab={"Simon","Chris","David","Sarko","Sego","Hardy","Patrick","Franck","Samir"};
Scanner sc=new Scanner(System.in);
System.out.print("Entrez un nom:");
String nom=sc.nextLine();
String reponse="Ce nom ne se trouve pas dans notre system";
for(int i=0;i<tab.length;i++)
{
if(tab[i].equals(nom))
{
reponse="Ce nom se trouve dans notre system;";
break;
}
}
}
System.out.print(reponse);
}
maintenant dans la ligne:
System.out.println(reponse);
println souligné
Salut,
if(tab[i].equals(nom))
{
reponse="Ce nom se trouve dans notre system;";
break;
}
}
}
System.out.print(reponse); <<<<<<<<<< place tout simplement cette ligne comme ceci:
if(tab[i].equals(nom))
{
reponse="Ce nom se trouve dans notre system;";
break;
}
System.out.print(reponse);
}
}
j'ai ecrit comme tu m'a conseillé
maintenant la ligne entier est souligné
en mettant souris il montre message suivant:
System.out.print can not be resolved or is not a field
package Mypackage;
import java.util.Scanner;
public class exercjavascanne
{
public static void main(String[] args)
{
String[]tab={"Simon","Chris","David","Sarko","Sego","Hardy","Patrick","Franck","Samir"};
System.out.print("Entrez un nom:");
Scanner sc=new Scanner(System.in);
String nom=sc.nextLine();
String reponse="Ce nom ne se trouve pas dans notre system";
for(int i=0;i<tab.length;i++)
{
if(tab[i].equals(nom))
{
reponse="Ce nom se trouve dans notre system;";
break;
}
System.out.print=(reponse);
}
}
}
maintenant la ligne entier est souligné
System.out.print=(reponse);
en mettant souris il montre message suivant:
System.out.print can not be resolved or is not a field
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
prg commence à marcher
Entrez un nom:David
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
pourtant le David existe,bizarre il dit ne se trouve pas dans notre system
j'ai entré xxx vous voyez le resultat est bizarre
Entrez un nom:xxx
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Entrez un nom:David
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
pourtant le David existe,bizarre il dit ne se trouve pas dans notre system
j'ai entré xxx vous voyez le resultat est bizarre
Entrez un nom:xxx
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Ce nom ne se trouve pas dans notre system
Oui,
Ce sera mieux comme ceci
Dan
Ce sera mieux comme ceci
public class exercjavascanne
{
public static void main(String[]args)
{
String[]tab={"Simon","Chris","David","Sarko","Sego","Hardy","Patrick","Franck","Samir"};
System.out.print("Entrez un nom:");
Scanner sc=new Scanner(System.in);
String nom=sc.nextLine();
String reponse="Ce nom ne se trouve pas dans notre system";
for(int i=0;i<tab.length;i++)
{
if(tab[i].equals(nom))
{
reponse="Ce nom se trouve dans notre system;";
break;
}
}
System.out.println(reponse);
}
}
Dan