0
public class Main {
public static void main(String[]args) { 
    int[] array = new int[10];

    for (int i= 0; i < array.length; i++) {
        array[i] = i; 
    }
    System.out.println(array);
}
}

Why is the output "[I@677327b6"? I am just trying to assign values to an array. I know this is a very basic question, however, I've been struggling to find the answer. Thanks for the help!

Jerry Stratton
  • 3,287
  • 1
  • 22
  • 30
  • 1
    Your input should work fine. If you want to print array elements, the statement should be like for (int i= 0; i < array.length; i++) { System.out.println(array[i]); } – Supun Amarasinghe Aug 17 '17 at 04:21
  • "[I@677327b6" it is a string that desrcibes the identity of the array. If you want to see its content, you can write: System.out.println(Arrays.toString(array)); – shivani thakur Aug 17 '17 at 05:33

0 Answers0