Simple traversal of Java two-dimensional array
•
Java
< span style="color:#000080;"> 1. The code is as follows: < pre style = "font family: Menlo; font size: 9pt;" >< span style="color:#000080;"> public class OverrideTest { public static void main(String[] args){ / h2 test=new h2(1); < span style="color:#808080;"> test. t1(); < span style="color:#808080;"> test. t2('c');/ < span style="color:#808080;"> < span style="color:#000080;"> int temp[][]= new int[ 3][]; temp[ 0]= new int[ 3]; temp[ 1]= new int[ 1]; temp[ 2]= new int[ 2]; temp[ 0][ 0]= 10; temp[ 0][ 1]= 11; temp[ 0][ 2]= 12; temp[ 1][ 0]= 20; temp[ 2][ 0]= 30; temp[ 2][ 1]= 31; < span style="color:#000080;"> for( int i= 0 i
< span style="color:#660e7a;"> length; i++) {
for( int j= 0 j
< span style="color:#660e7a;"> length; j++) System.< span style="color:#660e7a;"> out. println(temp[i][j]); } } } < pre style="font-family:Menlo;font-size:9pt;"> < pre style="font-family:Menlo;font-size:9pt;"> 2. The running results are as follows: < pre style = "font family: Menlo; font size: 9pt;" > 10 11 12 20 30 31
Process finished with exit code 0
总结
以上是编程之家为你收集整理的java二维数组简单遍历方式全部内容,希望文章能够帮你解决java二维数组简单遍历方式所遇到的程序开发问题。
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码