merged sorted array (why is there an issue) **unresolved**
61

so the question asks to merge two arrays and this is how I did it:
public class Solution {

public static int[] mergeArrays(int[] myArray, int[] alicesArray) {

    // combine the sorted arrays into one large sorted array
    int[]merged = new int[myArray.length + alicesArray.length];
    
    for (int i = 0; i<myArray.length; i++){
        myArray[i] = merged[i];
    }
    
    for(int i = 0; i<alicesArray.length; i++){
        alicesArray[i] = merged[i + myArray.length - 1];
    }

    Arrays.sort(merged);
    return merged;
    
}

but it gives this answer:
Solution.java:23: error: cannot find symbol
Arrays.sort(merged);
^
symbol: variable Arrays
location: class Solution
1 error

what am i doing wrong?

Comments (1)