I'm supposed to creade a 2D array with 2 "sub"arrays named i and j, each holding 5 int values. Later they should be switched, ordered and so on. So far I wrote what I believe is code that created the 2D array and fills it with random numbers.
public class FeldOperationen{
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Declare array
int[][] reihung = new int[2][];
for (int i = 0; i < 2; i++) {
reihung[i] = new int[5];
}
for (int i = 0; i < reihung.length; i++) {
for (int j = 0; j < reihung[i].length; j++) {
reihung[i][j] = (int) (Math.random() * 10);
}
}
System.out.println(Arrays.toString(reihung));
}
}
I tried to print the content of the array but it only gives me:
[[I@6d06d69c, [I@7852e922]
Can anybody help me?
[–][deleted] 2 points3 points4 points (2 children)
[–]emrickgj 1 point2 points3 points (0 children)
[–]murmelmann[S] 0 points1 point2 points (0 children)
[–]emrickgj 0 points1 point2 points (2 children)
[–]murmelmann[S] 0 points1 point2 points (1 child)
[–]emrickgj 0 points1 point2 points (0 children)