Array Creation and Access

AP Computer Science A· difficulty 2/5

Which declares an int array of size 10?

  • A

    int arr = new int[10];

  • B

    int arr[10];

  • C

    array<int> arr = new array(10);

  • D

    int[] arr = new int[10];

    check_circle

Explanation

Java syntax: <code>int[] arr = new int[10];</code> (also <code>int arr[]</code> is allowed).

Want 10 more like this — adaptive to your weak spots?

Related questions