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 28 29 30 31 32
|
public class triS {
public static void main(String[] args) {
// TODO Auto-generated method stub
int tab[] = {40,60,30,20,50};
triSelection(temp,tab[] ); // 1 la variable temp n'existe pas
// 2 on référence une variable par son nom, et le nom de la variable tab c'est tab, pas tab[]
}
} // 3 cette accolade fermante n'a rien à faire ici
public static void in []triSelection(int temp, int tab[]){ // 4 le type in n'existe pas, c'est int
int minimum;
for(i=0, i<tab.length; i++){ // 5 la variable i n'est déclarée nulle part : toute variable doit être déclarée (avec son type)
minimum=i;
temp=tab[i];
tab[i]=tab[i+1];
tab[i+1]=temp;
System.out.println(tab[i]);
}
return tab[i]; // 6 le retour de la méthode triSelection est un tableau et là tu retournes un élément de tableau (un int donc)
}
} |
Partager