-3

Java:

int [] list = new int [7];

System.out.print(list);

In the console it prints: [I@1f96302

Not only is it giving values other than ints, but it is giving more than I asked it too.

Community
  • 1
  • 1
Compe
  • 55
  • 1
  • 8

1 Answers1

0

[l@1f96302 is the default way an Object is printed (that's what Object's toString() method returns for arrays). Try System.out.print(Arrays.toString(list)) instead, which will display the elements of the array.

Eran
  • 387,369
  • 54
  • 702
  • 768
  • [I@1f96302 is the Java default way to print an object that has no toString() implementation. It is the internal runtime type and memory address: [ means Array, I means integer @ means 'now comes the mem address' and the memory address itself. – Jens-Peter Haack Dec 11 '14 at 06:25