Recherche mot
Résolu
soumatec
-
KX Messages postés 19031 Statut Modérateur -
KX Messages postés 19031 Statut Modérateur -
Bonjour, svp je n'arrive pas a trouver le probleme il m'indique qu'il y a une erreur dans la main
--Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - incompatible types: java.lang.String cannot be converted to java.lang.String[]
at Recherche.main(Recherche.java:27)--
--Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - incompatible types: java.lang.String cannot be converted to java.lang.String[]
at Recherche.main(Recherche.java:27)--
import java.util.Scanner;
package javaapplication1;
public class Recherche {
public String dic[];
public String mot;
public String lireMot(){
Scanner s=new Scanner(System.in);
System.out.println("donner le mot a rechercher");
return s.nextLine();
}
public void verifierMot(String mot){
int i;
int j;
for(i=0;i<dic.length;i++){
for(j=0;j<dic[i].length();j++){
if(mot.charAt(i)==dic[i].charAt(j))
System.out.println("le mot rechercher existe");
else
System.out.println("le mot rechercher n'existe pas");
}}
}
public static void main(String[] args) {
String []dic=("salut","tout");
Recherche mot=new Recherche();
String m=mot.lireMot();
mot.verifierMot(m);
}
}