Write a function called combineArray that takes three arrays (a, b,and c) of int
ID: 3614883 • Letter: W
Question
Write a function called combineArray that takes three arrays (a, b,and c) of int values as its arguments (parameters). Thefunction goes through the first two arrays element by element, addsup the values in a[i] and b[i], and stores the results in c[i]. The function's return value will be boolean, and it willreturn false if any of the three arrays have different lengths;otherwise, it returns true.I wrote the function and it compiles but the output is gibberish(Ex. [I@388c74)
Not understanding what is happening.
Here is the code I have:
public class combineArrays{
//public static void main(String [] args){
public static int [] combineArrays(int [] a, int []b){
int[] listSum = new int[6];
for (int i = 0; i < 6; i++)
listSum[i] = a[i] +b[i];
return listSum;
}
public static void main(String [] args){
int[] lista = { 3, -1, 0, 3, 5, 9};
int[] listb = { 4, 2, 0, 1, 2, -3 };
// int[] listSum = new int [6];
for (int i = 0; i < 6; i++){
System.out.println(combineArrays(lista,listb));
}
}
}