RDV+DIAL chat illimit� dans ta r�g!
no save
Assistance
Achat
News

Forum | programmation
tableau java
-=(L)=-, le mer. 28 févr. 2007 à 12:59:47
Salut les gens,

Voila je vous explique mon probleme :

J'ai crée un tableau en java
static String TableauBallon[][] = new String [10][2];

et je veut que l'utilisateur de ce prog est la possibilité de supprimer une occurance de ce tableau j'ai testé

TableauBallon[x][y]= null;
TableauBallon[x][y]= void;

mais bien sur cela ne fonctionne pas ^^

donc voila si vous avez une idée, je suis preneur je met mon script complet en dessous :




public class essai {

static int i = 0;
static int j = 0;

public String identificateur; // identifier un ballon
public int taille; // taille du ballon
public void Ballon(String z, int t) {} // constructeur
public String toString() {
return identificateur;} // l'instance en string

static String TableauBallon[][] = new String [10][2];

public static void main (String args[]){

int s = 1;

while ( s!=0){

System.out.println("+++++++++++++(MENU)+++++++++++++");
System.out.println("1) Créer un ballon");
System.out.println("2) Détruire un ballon");
System.out.println("3) Afficher la liste des ballons");
System.out.println("0) Quitter");
System.out.println("++++++++++++++++++++++++++++++++");
System.out.println("");
System.out.println("(Veuillez faire votre choix)");


s = Keyboard.readInt();

switch (s) {

case 1 :
creer_instance();
break;

case 2 :
detruire_element_instance();
break;

case 3 :
afficher_instance();
break;

case 0 :
System.out.println("Au revoir !");
System.exit(0);

break;

}

}

}
private static void detruire_element_instance() {
System.out.println("Quel ballon souhaiter vous supprimer ?");
String detruire = Keyboard.readString();
for (int x = 0 ; x < 10 ; x++ ){
for (int y = 0 ; y < 2 ; y++ ){

if(TableauBallon[x][y] == detruire){

TableauBallon[x][y]= "null";
System.out.println("Le ballon "+detruire+" à bien été supprimer");

}

}
}

}
private static void afficher_instance() {

for (int x = 0 ; x < 10 ; x++ ){
for (int y = 0 ; y < 2 ; y++ )
System.out.println(TableauBallon[x][y]);
}
}
private static void creer_instance() {
System.out.println("Tapez un indentifiant pour votre ballon :");
String identifiant = Keyboard.readString();
System.out.println(identifiant);
TableauBallon [i][j] = identifiant;
j=j+1;
System.out.println("Tapez une taille pour votre ballon :");
int t = Keyboard.readInt();
String taille=Integer.toString(t);
System.out.println(taille);
TableauBallon [i][j] = taille;
i=i+1;
j=j-1;

}

}





Sims'
févr. 07
Suivant
REPONSES
Sims'
févr. 07
-=(L)=-
févr. 07
Sims'
févr. 07
debutant
oct. 07
fulgenceong
déc. 07
Iroiim
janv. 08
Sims'
janv. 08
aa
15 févr.
Version Web
Réalisé par RedShift
no save