1

Here is the source code

class App {
public static void main(String[] args){

    int[] x = {0,1,2,3,4,5,6,7,8,9};
    int[] xcopy = java.util.Arrays.copyOfRange(x,0,3);

    System.out.println(xcopy);
}
}

The code compiles without error, but the result is this:

[I@659e0bfd

when it should be:

0,1,2

Why isn't this working? or more interestingly, where did the initial result come from?

DDKL
  • 11
  • 2

1 Answers1

0

You are trying to print out an array. You should be using a loop to iterate through the array and print out each individual int

Eymen
  • 142
  • 1
  • 10