Topic: 师傅 多维数组怎么理解:)

  Print this page

1.师傅 多维数组怎么理解:) Copy to clipboard
Posted by: aiff
Posted on: 2004-10-19 12:41

int A[][][]={{{5,1,7},{6,7}},{{9,4},{8,3}}};和
int A[][][]={{{5,1},{6,7}},{{9,4},{8,3}}};输出的时候一样的! 为什么

2.Re:师傅 多维数组怎么理解:) [Re: aiff] Copy to clipboard
Posted by: littledeer1974
Posted on: 2004-10-19 13:23

是怎么输出的呢

3.Re:师傅 多维数组怎么理解:) [Re: aiff] Copy to clipboard
Posted by: aiff
Posted on: 2004-10-19 13:38



4.Re:师傅 多维数组怎么理解:) [Re: aiff] Copy to clipboard
Posted by: aiff
Posted on: 2004-10-19 13:49

public class shuzu{
public static void main(String args[])
{
int i,j,k,sum=0;
int A[][][]={{{5,1,7},{6,7,2,5}},{{9,4,6},{8,3}}}; // ?声明数组并设置初值??
{
for(i=0;i<A.length;i++)  // 输出数组内容并计算总和
for(j=0;j<A[i].length;j++)
for(k=0;k<A[j].length;k++)
        {
System.out.print("A["+i+"]["+j+"]["+k+"]=");
System.out.println(A[i][j][k]);
}
}
}}

5.Re:师傅 多维数组怎么理解:) [Re: aiff] Copy to clipboard
Posted by: yoti
Posted on: 2004-10-19 13:51

public class Output {
public static void main(String args[])
{
int i,j,k,sum=0;
int A[][][]={{{5,1},{6,7,2,5}},{{9,4,6},{8,3}}}; // ?声明数组并设置初值??
{
for(i=0;i<A.length;i++)  // 输出数组内容并计算总和
for(j=0;j<A[i].length;j++)
for(k=0;k<A[i][j].length;k++)
{
System.out.print("A["+i+"]["+j+"]["+k+"]=");
System.out.println(A[i][j][k]);
}
}
}
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923