recuperer les valeurs d un tableau
Bonjour,
Ma question est de savoir comment recuperer un tabelau dans une fonction,
je fais ceci mais j 'ai juste la derniere case du tableau.
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
| public class test1 {
/**
* @param args
*/
public static int tableau{
int n = 5,j=1 ;
int tab[]= new int[n];
for(int i=0; i<tab.length;i++ ){
tab[i] =j;
j++;
}
return(tab);// impossible de recuperer les valeurs du tableau
}
public static void main(String[] args) {
// TODO Auto-generated method stub
int a;
a= tableau(tab);
System.out.print("[ "+a+" ]" + ",");
}
}
} |