voila l enonce:
Ecrire une fonction dénommée chaîneTableau prenant en paramètre un tableau d'entiers à une
dimension. Et retournant une Chaîne qui représente les éléments du tableau.
je vois pas trop comment faire
je suis un debutant c est ma premiere annee
import java.util.Scanner ; public class Ex5 { public static void main ( String[] args ) { Scanner clavier = new Scanner ( System.in ) ; int taille,nbr; String chaine; System.out.println("Introduisez la taille du tableau: "); taille=clavier.nextInt(); int[] tab=new int[taille]; for (int i=0;i<tab.length;i++) { System.out.print("Introduisez un nombre: "); nbr=clavier.nextInt(); tab[i]=nbr; } chaine=chaineTableau(tab); System.out.println(chaine+" "); } public static String chaineTableau (int[] tab) { String chaine; for (int i=0;i<tab.length;i++) { chaine=tab[i] ; return chaine; } } }
Cordialement.