You should initialize variables C and d before to use them, because Java sees arrays as objects and they are allocated in Heap memory.

`double[][] C = new double[A.length][B[1].length]`

`double[][] d = new double[a.length][b[1].length]`

Answer:1

You have not initialised dimension of array variable therefore compiler will not know the size that array need to be allotted.

double[][] C=new double[A.length][B[0].length]; double[][] d=new double[b.length][b[0].length];

also in your code at many places you have used 1 based index for measuring count of column in 2D array which can result into violation of memory access(OutofBound Exception)

here is modified programme.

```
public class Matrixmultadd {
static double[][] matrixMult(double[][] A,double[][] B) {
double[][] C=new double[A.length][B[0].length]; //declar this variable for return the result
//return null if on of matrix are null
if(A == null || B == null){
return null;
}
if(A[0].length == B.length){ //check to be equal columns of A with rows of B
for(int n = 0;n < A.length;n++){//n is numbers of rows of A
for(int k = 0;k < B[0].length;k++){
C[n][k] = 0.0;
for(int l = 0;l < A[0].length;l++){//row n of A multiple in column k of B
C[n][k] += A[n][l] * B[l][k];
}
}
}
return C;
} else {
return null;
}
}
static double[][] matrixAdd(double[][] a,double[][] b) {
//check the rows and columns of a and b are equal
if(a.length == b.length && a[0].length == b[0].length){
int row=b.length;
int col=b[0].length;
double[][] d=new double[row][col]; //declar this variable for return the result
for(int n = 0;n <row;n++){
for(int m = 0;m <col;m++){
d[n][m] = a[n][m] + b[n][m];
}
}
return d;
}else {
return null;
}
}
static void matrixDisplay(double[][] a){
int row=a.length;
int col=a[0].length;
for(int i = 0; i < row;i++){
for(int k = 0;k < col;k++){
System.out.print(a[i][k] + "\t");
}
System.out.println();
}
}
```

public static void main(String[] args){ double[][] A = {{1,2,3},{4,5,6}};

```
double[][] B= {{1,2},{3,4},{5,6}};
double[][] d;
d = matrixMult(A,B);
matrixDisplay(d);
```

}

}

Answer:2

I'm wondering if there was a way to get the sigar compiled binaries ie. libsigar-universal-macosx.dylib etc.. using maven. i know that i can just manually add it but I wish to automate the deployment

In my below FileWriter below, I am writing to a file called "employee.txt." It writes to the file but originally it was only appending to the file vs going into a new line each time. I since then ...

I have a class with a couple of methods that convert from one generic type to another, but I want to return the original value if both: the argument type and the return type are the same. The best ...

I have this small piece of code for a prototype. I'm trying to have it so that on mousePressed() or on mouseClicked() the colour of the line clicked on will change. I can't for the life of me ...