赞
踩
package Experiment.Java.test10; public class test01 { public static void main(String[] args) { int [][] array ={{1,2,5,9},{2,3,8,5},{3,5,6,4}}; for (int i = 0; i <array.length ; i++) { //i=0是因为下标从0开始----外层循环 for (int j = 0; j <array[i].length ; j++) {//内层循环,循环数组里的每个元素 System.out.print(array[i][j]+"\t"); } System.out.println(); //每个数组遍历完就换行 } System.out.println("=============="); for (int i = 0; i <=array.length ; i++) { for (int j = 0; j <array.length ; j++) { System.out.print(array[j][i]+"\t"); } System.out.println(); } } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。