package newpackage1;
public class 二维数组 {
public static void main(String args[]) {
int a[][] = {
{1, 2}, {3, 4}, {5, 6}, {7, 8}
};
for (int i = 0;
i < a[
0].length;
i++) {
int j = 0;
for (; j < a.length; j++) {
System.out.print(a[j][i]);
}
System.out.println();
}
System.out.println();
int i = 0;
int j = 0;
for (; i < a.length;
i++) {
j = 0;
for (; j < a[0].length; j++) {
System.out.print(a[i][j]);
}
System.out.println();
}
}
}
public class 二维数组 {
public static void main(String args[]) {
int a[][] = {
{1, 2}, {3, 4}, {5, 6}, {7, 8}
};
for (int i = 0;
i < a[
0].length;
i++) {
int j = 0;
for (; j < a.length; j++) {
System.out.print(a[j][i]);
}
System.out.println();
}
System.out.println();
int i = 0;
int j = 0;
for (; i < a.length;
i++) {
j = 0;
for (; j < a[0].length; j++) {
System.out.print(a[i][j]);
}
System.out.println();
}
}
}