Home » JAVA Programming » Arrays » Question
  1. What will this code print?

    public class array
    {
    public static void main(String args[])
    {
    int arr[] = new int [7];
    System.out.print(arr);
    }
    }
    1. [I@2a139a55
    2. Runtime Error
    3. 0 0 0 0 0 0 0
    4. Compilation error
    5. None of these
Correct Option: A

If we trying to print any reference variable internally, toString() will be called which is implemented to return the String in following form:
[I@2a139a55



Your comments will be displayed only after manual approval.