Output for java snippet unexpected after return statement, not allowed to use a library import

Viewed 12

The output for the code is supposed to reverse an array to print out 1, 6, 7, 4, 3. I am not sure why the output is [I@5acf9800. Am I inputting something wrong?

public class lab4 {
        public static int[] reverseArrray(int[] arr){
            int pointerOne = 0;
            int pointerTwo = arr.length - 1;
    
            while (pointerOne < pointerTwo){
                int temp = arr[pointerOne];
                arr[pointerOne] = arr[pointerTwo];
                arr[pointerTwo] = temp;
                pointerOne++;
                pointerTwo--;
            }
            return arr;
        }
    
        public static void main(String[] args){
            int[] arr = {3, 4, 7, 6, 1};
            System.out.println(reverseArrray(arr));
        
        }
    }
0 Answers
Related