欢迎来到天天文库
浏览记录
ID:8814668
大小:12.56 KB
页数:2页
时间:2018-04-08
《java中数组与c#数组的区别》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、java中使用二维 数组publicclassArray2D...{ publicstaticvoidmain(Stringargs)...{ intmyInt=newint[10]; //遍历,给数组中的每一个数组赋值 for(inti=0;i2、="+myInt.length+",myInt[0].length="+myInt[0].length); //输出数组每一维的下限和上限 for(inti=0;i3、ngth;i++)...{4、 //遍历,给数组中的每一个数组赋值 for(inti=myInt.GetLowerBound(0);i<=myInt.GetUpperBound(0);i++) { for(intj=myInt.GetLowerBound(1);j<=myInt.GetUpperBound(1);j++) { myInt[i,j]=i*j; } } //输出数组每一维的下限和上限 for(inti=0;i5、 Console.WriteLine("{0}{1}{2}",i,myInt.GetLowerBound(i),myInt.GetUpperBound(i)); } //遍历,输出二维数组中每一个元素的个数 for(inti=myInt.GetLowerBound(0);i<=myInt.GetUpperBound(0);i++) { for(intj=myInt.GetLowerBound(1);j<=myInt.GetUpperBound(1);j++) { 6、 Console.WriteLine("myInt[{0},{1}]={2}",i,j,myInt[i,j]); } } Console.ReadLine(); } }
2、="+myInt.length+",myInt[0].length="+myInt[0].length); //输出数组每一维的下限和上限 for(inti=0;i3、ngth;i++)...{4、 //遍历,给数组中的每一个数组赋值 for(inti=myInt.GetLowerBound(0);i<=myInt.GetUpperBound(0);i++) { for(intj=myInt.GetLowerBound(1);j<=myInt.GetUpperBound(1);j++) { myInt[i,j]=i*j; } } //输出数组每一维的下限和上限 for(inti=0;i5、 Console.WriteLine("{0}{1}{2}",i,myInt.GetLowerBound(i),myInt.GetUpperBound(i)); } //遍历,输出二维数组中每一个元素的个数 for(inti=myInt.GetLowerBound(0);i<=myInt.GetUpperBound(0);i++) { for(intj=myInt.GetLowerBound(1);j<=myInt.GetUpperBound(1);j++) { 6、 Console.WriteLine("myInt[{0},{1}]={2}",i,j,myInt[i,j]); } } Console.ReadLine(); } }
3、ngth;i++)...{
4、 //遍历,给数组中的每一个数组赋值 for(inti=myInt.GetLowerBound(0);i<=myInt.GetUpperBound(0);i++) { for(intj=myInt.GetLowerBound(1);j<=myInt.GetUpperBound(1);j++) { myInt[i,j]=i*j; } } //输出数组每一维的下限和上限 for(inti=0;i5、 Console.WriteLine("{0}{1}{2}",i,myInt.GetLowerBound(i),myInt.GetUpperBound(i)); } //遍历,输出二维数组中每一个元素的个数 for(inti=myInt.GetLowerBound(0);i<=myInt.GetUpperBound(0);i++) { for(intj=myInt.GetLowerBound(1);j<=myInt.GetUpperBound(1);j++) { 6、 Console.WriteLine("myInt[{0},{1}]={2}",i,j,myInt[i,j]); } } Console.ReadLine(); } }
5、 Console.WriteLine("{0}{1}{2}",i,myInt.GetLowerBound(i),myInt.GetUpperBound(i)); } //遍历,输出二维数组中每一个元素的个数 for(inti=myInt.GetLowerBound(0);i<=myInt.GetUpperBound(0);i++) { for(intj=myInt.GetLowerBound(1);j<=myInt.GetUpperBound(1);j++) {
6、 Console.WriteLine("myInt[{0},{1}]={2}",i,j,myInt[i,j]); } } Console.ReadLine(); } }
此文档下载收益归作者所有