-2

I'm new to Java but not new to programming. I ran the following code in Eclipse:

int[] intArray = new int[5];
System.out.println(intArray);

and received the following output:

[I@17f7be7b

I'm sure StackOverflow already contains the correct way to create an array in Java. What I'd like to know is: what did I do?


Edit: Sorry... The link above my post isn't a duplicate question, and it doesn't answer my question. TylerAndFriends' link is closer, but I was hoping for an explanation of exactly what I printed. Tyler's linked thread says "the default method is to display the object's class name representation, then "@" followed by its hashcode". Can someone elaborate?

Jim V
  • 1,131
  • 12
  • 22

1 Answers1

0

Use this

       for (int i : intArray) {
            System.out.println(i);
        }
Kick
  • 4,823
  • 3
  • 22
  • 29