alex64100
Messages postés25Date d'inscriptionjeudi 7 août 2008StatutMembreDernière intervention 8 novembre 2009
-
8 nov. 2009 à 17:03
solo9saad
Messages postés9Date d'inscriptiondimanche 17 mai 2009StatutMembreDernière intervention 6 décembre 2009
-
9 nov. 2009 à 13:25
bonjour,
je dois réaliser un programme qui accepte un tableau d'entiers saisi au clavier et qui le trie.
ma méthode trie est bonne.
le problème vient de la saisie des données, le compilo m'affiche :
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at EXO1.main(EXO1.java:72)
voici le code :
import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.*;
public class EXO1 {
int i,ind;
String x=JOptionPane.showInputDialog("Veuillez saisir la dimension du tableau : ");
ind = Integer.parseInt(x);
int [] tab = new int [ind];
Scanner sc = new Scanner(System.in);
for (i= 0; i < ind; i++) {
x=JOptionPane.showInputDialog("Veuillez saisir le chiffre :"+i);
tab[i] = Integer.parseInt(x);