Question: How to return the 2d array The code below is made up 2d array that is taking in two 1d arrays public int speedNAngels( int
How to return the 2d array
The code below is made up 2d array that is taking in two 1d arrays
public int speedNAngels( int [] speedsArray, int numOfSpeed, int [] angelsArray, int numOfAngels) {
int [][] speedAngels = new int [numOfSpeed][numOfAngels];
int row =0;
int col =0;
for(row =0; row < speedsArray.length; row++){
speedAngels[row][0] = speedsArray[row];
}
for(col =0; col < angelsArray.length; col++ ){
speedAngels[col][1] = angelsArray[col];
}
// string result = speedAngels[i][0]+" "+speedAngels[i][1];
return;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
