int arr[]={12,34,56}; System.out.println(arr[3]); it will give index out of bounds as last index is 2 .