id000
Messages postés23Date d'inscriptionjeudi 7 février 2008StatutMembreDernière intervention 2 juin 2009
-
23 mars 2008 à 11:57
id000
Messages postés23Date d'inscriptionjeudi 7 février 2008StatutMembreDernière intervention 2 juin 2009
-
23 mars 2008 à 21:19
Bonjour
lorsque j'ai compilé ce code:
import java.util.*;
public class delim
{public static void main(String[] args)
{ String chaine="Si a\nSi b\nAlors c\n Si f\nSi j\nAlors a\nSi b\nAlors w";
StringTokenizer st = new StringTokenizer(chaine, "\n");
int nt=st.countTokens();
String t[] = new String[nt];
int i = 0;
while (st.hasMoreTokens()){
t[i++]=st.nextToken();}
Fait f[]=new Fait[nt];
for(int j=0;j<nt;j++)
{ String mot=new String();
{if( t[j].startsWith("Si "))
mot=t[i].substring(2);
for( int k=0 ; k<nt ; k++)
{ f[k].libelle=mot;
System.out.println("Faits=="+ f[k].libelle);
}
}
}
}
}
// *declaration des fait
class Fait
{ String libelle;
boolean etat=true;
boolean demandable=true;
boolean editable=true;
int deduitde;
}
il ne me renvoi aucune érreur mais a l'exécution il m'affiche exception in thread main
d'aprés vous quel le probléme svp j'ai besoin de votre aide
id000
Messages postés23Date d'inscriptionjeudi 7 février 2008StatutMembreDernière intervention 2 juin 2009 23 mars 2008 à 18:55
merci ,j'ai corrigé l'instruction mot=t[i].substring(2); et pour f[k] j'ai crée déjat un objet
Fait f[]=new Fait[nt];
le probléme reste le meme toujours
je suit un débutant SVP aide