Code java avec les vectors

Résolu/Fermé
alffouss Messages postés 121 Date d'inscription mercredi 15 octobre 2008 Statut Membre Dernière intervention 20 octobre 2021 - 3 août 2009 à 10:03
alffouss Messages postés 121 Date d'inscription mercredi 15 octobre 2008 Statut Membre Dernière intervention 20 octobre 2021 - 3 août 2009 à 11:48
Bonjour,
j'ai créé un code java avec les vectors et j'aimerais bien ajouter un tripler dans mon vecteur. le PB c'est que quand je fais entré un triplet dans mon vecteur et que je soufaite afficher ce vecteur, cela ne fonctionne pas?

vous pouvez voir ce qui ne va pas dans mon code et notamment la methode affiché?

voici mon code

*******************************************************************
import java.util.*;
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.*;
public class Tok4 {

public Tok4(){
Vector vect=new Vector();
}

static public void Verifier(String I1){

StringTokenizer parser = new StringTokenizer((I1),";");
String IP=parser.nextToken();
String login=parser.nextToken();
String passe =parser.nextToken();
if (((IP.length()<17)&& (IP.length()>7))||
(((login.length()<20)&& (login.length()>8))||
(((passe.length()<20)&& (passe.length()>8))))){
// System.out.println(IP);
// System.out.println(login);
// System.out.println(passe);
System.out.println(""+IP+";"+login+";"+passe);
//return;
}else{
System.out.println("Faux "+IP+";"+login+";"+passe);
}

}

// afficher un tableau

static public void ajouter(String I1){
Vector tab = new Vector();
StringTokenizer parser = new StringTokenizer((I1),";");
String IP=parser.nextToken();
String login=parser.nextToken();
String passe =parser.nextToken();
if (((IP.length()<17)&& (IP.length()>7))||
(((login.length()<20)&& (login.length()>8))||
(((passe.length()<20)&& (passe.length()>8))))){
tab.addElement(I1);
System.out.println (tab);
}else{
System.out.println("C'est faux"+ tab);
}
}

static public void supprimer(String I1){
Vector tab = new Vector();
StringTokenizer parser = new StringTokenizer((I1),";");
String IP=parser.nextToken();
String login=parser.nextToken();
String passe =parser.nextToken();
tab.removeElement(I1);
System.out.println (tab);
}

static public void affiché (){
Vector tab = new Vector();
int i;
String tabEntiére="";
for (i=0;i<tab.size();i++){
tabEntiére=tabEntiére+tab.elementAt(i);
System.out.println("le ba est"+tabEntiére );


}

}

public static void main (String []agrs){

//Verifier("255.255.255.25;581reeg1;h18941in");
//Verifier("10.25.365.89;popokgp,erg;oigozbfo8789");
//ajouter("10.25.365.89;pop5894kgperg;tototototot");
//ajouter("165.23.65.8;Ibrahima;Doudou594*");
affiché ();
//supprimer("165.23.65.8;Ibrahima;Doudou594*");
}

}
***********************************************************

merci d'avance pour votre aide
A voir également:

3 réponses

Au lieu de recréer un sujet inutilement, il aurait été judicieux de faire un UP l'ancien..
0
alffouss Messages postés 121 Date d'inscription mercredi 15 octobre 2008 Statut Membre Dernière intervention 20 octobre 2021 5
3 août 2009 à 10:19
je l'ai fais, et j'ai essayer d'adapter mon code à ce que j'ai trouver, mais je ne trouve pas la solution.
0
alffouss Messages postés 121 Date d'inscription mercredi 15 octobre 2008 Statut Membre Dernière intervention 20 octobre 2021 5
3 août 2009 à 11:48
QLQ peut m'aider SVPL
0