标签:return java学习 ring package pac out ati ++ 输出
package MyDuoWeiShuZu;
public class Mycode {
public static void show(int[][] c){
for(int j=0;j<c.length;j++){
for(int i=0;i<c.length;i++){
System.out.print(c[j][i]+"\t");
}
System.out.println();
}
}
public static int[][] add(int[][] a,int[][] b){
int[][] c = new int[a.length][a.length];
for(int i=0;i<a.length;i++){
for(int j=0;j<a.length;j++){
c[i][j]=a[i][j]+b[i][j];
}
}
return c;
}
public static void main(String[] args){
int[][] a = {
{1,2},
{3,4}
};
int[][] b = {
{1,2},
{3,4}
};
show(add(a,b));
}
}
输出结果:
2 4
6 8
标签:return java学习 ring package pac out ati ++ 输出
原文地址:http://www.cnblogs.com/iamAnonymous/p/6057218.html