java二维数组简单遍历方式
2016-11-22 10:17
344 查看
1、代码如下:
public class OverrideTest { public static void main(String[] args){ /* h2 test=new h2(1); test.t1(); test.t2('c');*/ 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; for(int i=0;i<temp.length;i++) { for(int j=0;j<temp[i].length;j++) System.out.println(temp[i][j]); } } }
2、运行结果如下:
10 11 12 20 30 31 Process finished with exit code 0
相关文章推荐
- Java 遍历文件夹的几种方式及简单性能对比
- Java两种简单方式遍历Map集合
- list 遍历方式(包括java8 Lambda)的比较和简单分析
- 转]Java中HashMap遍历的两种方式
- Java中HashMap遍历的两种方式
- 最简单的对Java List列表按中文拼音排序的实现方式
- 遍历HashMap HashTable的最简单的方式
- 第2章 Java编程基础——FAQ2.25 如何实现一维和二维数组的遍历?
- java Map对象的遍历方式
- 二叉树的java构建和三种遍历方式
- java集合遍历三种方式
- java定义二维数组的两种方式比较
- 一个java实现的简单日历,采用左树右列表的方式实现,具有参考意义
- Java遍历HashMap的两种方式
- 以简单的方式消除 Java 的冗长 (Lombok的安装使用)
- java 鼠标简单控制和浮点数在内存中的表示方式
- java中四种操作xml方式的比较以及四种方法的简单例子
- B/S协同处理的简单实现(reversed Ajax的comet方式Java山寨版)
- php中遍历二维数组的几种方式
- java 定义二维数组的多种方式