tcppunk
Erfahrenes Mitglied
Muss man irgendwas beim sortieren von 2dimensionalen Arrays beachten? Bekomme einen Haufen Fehlermeldungen bei diesem Programm:
import java.util.*;
public class Test {
public static void main (String[] args) {
int x,y=0;
int test[][] = new int[10][2];
//verarbeitung
while(y<2){
for ( x=0 ;x<10 ;x++ ) {
test[x][y]=(int)(Math.random()*30);
}
y++;
}
//Sortierung
Arrays.sort(test);
//Ausgabe
for ( y=0 ;y<2 ;y++ ) {
for ( x=0 ;x<10 ;x++ ) {
System.out.println(test[x][y] );
}
}
}
}
(sorry falls es dieses Thema schon gab)
import java.util.*;
public class Test {
public static void main (String[] args) {
int x,y=0;
int test[][] = new int[10][2];
//verarbeitung
while(y<2){
for ( x=0 ;x<10 ;x++ ) {
test[x][y]=(int)(Math.random()*30);
}
y++;
}
//Sortierung
Arrays.sort(test);
//Ausgabe
for ( y=0 ;y<2 ;y++ ) {
for ( x=0 ;x<10 ;x++ ) {
System.out.println(test[x][y] );
}
}
}
}
(sorry falls es dieses Thema schon gab)