السلام عليكم
كيفكم ؟؟؟
اعطتنا الاستاذه سؤال وهو :
write a method to add two arrays (two dimensional arrays), the header of the method is as follow:
public static int[][] addArray(int[][]a,int[][]b(
وحليته بس طلع لي خطأ
ياليت تقولو لي ايش الخطأ وتوضحونه ومشكووريين
هذا الكود
import javax .swing.*;
class Add{
public static void main (String args[]){
int a[][]=new int[4][3];
int b[][]= new int[3][4];
int res[][]=new int[3][4];
for (int i=0 ; i<a.length ;i++){
for (int j=0 ;j<a.length ;j++)
a[j]=Integer.parseInt(JOptionPane.showInputDialog(null," Enter value of the Array 1 "));
}
for (int i=0 ; i<b.length ;i++){
for (int j=0 ;j<b.length ;j++)
b[j]=Integer.parseInt(JOptionPane.showInputDialog(null," Enter value of the Array 2 "));
}
public static int[][] addArray(int[][]a ,int[][]b){
for (int i=0 ; i<res.length ;i++){
for (int j=0 ;j<res.length ;j++)
int res[j]=a[j]+b[j];
}
}
addArray();
for (int i=0 ; i<res.length ;i++){
for (int j=0 ; j<res.length ; j++)
System.out.println("The sum of the two array"+res);
}
}
}