Java 代码如下:
public static void arraySlice() {
String[] array = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"};
int column = 3;
for (int i = 0, row = 0, col = 0; i < array.length; i++) {
System.out.print(array[i] + "\t");
col++;
if (col == column) {
System.out.println();
col = 0;
row += 1;
}
}
}