效果如图
----------------------
public class TestArray {
public static void method(int[][] array) {
for (int i = 0; i <兆纯 array.length; i++) {
for(int j=0;j System.out.print(array[i][j]+" "雹猜册源宏); } System.out.println(); } } public static void main(String args[]) { int[][] array={{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3}}; method(array); } }
效果如伍念图
----------------------
public
class
TestArray
{
public
static
void
method(int[][]
array)
{
for
(int
i
=
0;
i
<腔中困
array.length;
i++)
{
for(int
j=0;j
");
}
System.out.println();
}
}
public
static
void
main(String
args[])
{
int[][]
array={{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3}};
method(array);
}
}
效果如图
----------------------
public
class
TestArray
{
public
static
void
method(int[][]
array)
{
for
(int
i
=
0;
i
<
array.length;
i++)
{
for(int
j=0;j
");
}
System.out.println();
}
}
public
static
void
main(String
args[])
{
int[][]
array={{1,2,3},{1,2,3},{1,2,3},{1,2,3},{1,2,3}};
method(array);
}
}
可以如下操兆渣作:
int[][] num = new int [5][3];
//num为5*3的二位数组
init(num);
//为族坦悄num数组负值
for(int i=0;i<3;i++)
{
for(int j=0;j<5;j++)
{
System.out.print(num[j][i]);
System.out.print(" ");
}
System.out.print("\n");
}
//双重for循环实现二维数信亏组的转置输出
That's all.