A voir également:
- Java-Unresolved compilation problem:
- Jeux java itel ✓ - Forum Jeux vidéo
- Telecharger java - Télécharger - Langages
- Java apk - Télécharger - Langages
- Scanf en java ✓ - Forum Java
- Java heap space ✓ - Forum Java
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