Q:

Array printing weird character

I'm trying to create a program that removes a given character from an array and then prints out the new array and whenever I print it out I get weird results like [I@120acab
public static int[] removeVal(int[] numArray, int val)
{
    int purge = 0;
    int keep = 1;
    int arrayVal = 0;
    for (int item : numArray)
    {
        if(item == val)
        purge = purge + 1;
        else
        keep = keep + 1;
    }    
    int[] newArray = new int[keep];
    for (int taco : numArray)
    {
        if(taco != val)
            newArray[arrayVal] = taco;
            arrayVal = arrayVal + 1;
    }
    return newArray;
}

A:

You should use Arrays.toString to print the array. This will show the individual elements of the array.
The default toString implementation of Object class returns what you see.

