Vector<String> probleme l'execution
Salut tous le monde j'est un probleme ou niveu de mon code est je ne voit pas le probleme
:cry:
voisi le code:
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 29 30 31 32 33 34
| import java.util.*;
public class Chaine {
private Vector mots;
private String phrase;
//constructeur
public Chaine(String phrase){
this.phrase=phrase;
Vector<String> mots =new Vector<String>();
}
//Méthodes
public void extraireMots(){
StringTokenizer st=new StringTokenizer(phrase);
while(st.hasMoreTokens());
String Mot=st.nextToken();
if(!mots.contains(Mot)){
mots.add(Mot);
}
}
public void afficherMots(){
for(int i=0;i<mots.size();i++){
System.out.println(mots.get(i));
}
}
//get
public String getPhrase(){
return(phrase);
}
public Vector getMots(){
return(mots);
}
} |
l'erreur qui affiche est :
The type Vector is not generic; it cannot be parameterized with arguments <String>
Syntax error, parameterized types are only available if source level is 5.0
mots cannot be resolved