2015-04-20 15:36:01 -07:00
|
|
|
|
//: arrays/AssemblingMultidimensionalArrays.java
|
2015-05-29 14:18:51 -07:00
|
|
|
|
// <20>2015 MindView LLC: see Copyright.txt
|
2015-04-20 15:36:01 -07:00
|
|
|
|
// Creating multidimensional arrays.
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
public class AssemblingMultidimensionalArrays {
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
Integer[][] a;
|
|
|
|
|
a = new Integer[3][];
|
|
|
|
|
for(int i = 0; i < a.length; i++) {
|
|
|
|
|
a[i] = new Integer[3];
|
|
|
|
|
for(int j = 0; j < a[i].length; j++)
|
|
|
|
|
a[i][j] = i * j; // Autoboxing
|
|
|
|
|
}
|
|
|
|
|
System.out.println(Arrays.deepToString(a));
|
|
|
|
|
}
|
|
|
|
|
} /* Output:
|
|
|
|
|
[[0, 0, 0], [0, 1, 2], [0, 2, 4]]
|
|
|
|
|
*///:~
|