首页 > 编程语言 > 详细

6.7-4将二维数组行列互调

时间:2015-10-10 10:14:22      阅读:169      评论:0      收藏:0      [点我收藏+]
package shuzu;

public class HLHD {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		int arr[][] = {{1,2,3,},{4,5,6},{7,8,9}};
		
//		for(int narr[] : arr)
//		{
//			for(int x : narr)
//			{
//				System.out.print(x);
//			}
//			System.out.println();
		
//		}
		
		for (int x = 0; x < arr.length; x++)
		{
			for(int y = 0; y < arr[x].length; y++)
			{
				int x1 = x;
				int y1 = y;
				int temp = x1;
				x1 = y1;
				y1 = temp;
				System.out.print(arr[x1][y1]);
	//			System.out.print("x1="+x1+",");
	//			System.out.print("y1="+y1+" ");
				
			}
			System.out.println();
		}
	
	
	
	
	
	
	}

}

  

6.7-4将二维数组行列互调

原文:http://www.cnblogs.com/dirgo/p/4865805.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!