java定义一个4行4列的二维数组。第一行和第4行数据进行交换 刚学不太懂!感谢大佬们!!

如题所述

// java定义一个4行4列的二维数组。第一行和第4行数据进行交换 刚学不太懂!感谢大佬们!!
String[][] inarr = {{"A1","A2","A3","A3"},{"B1","B2","B3","B4"},{"C1","C2","C3","C4"},{"D1","D2","D3","D4"}};

String[] temp = {};
temp = inarr[0];
inarr[0] = inarr[3];
inarr[3] = temp;

// end
温馨提示:答案为网友推荐,仅供参考
第1个回答  2016-12-02
for(int i=0;i<4;i++){
a=arr[0][i];
arr[3][i]=arr[0][i];
arr[0][i]=a;}

搞定追问

感谢!

本回答被提问者采纳
相似回答