> For the complete documentation index, see [llms.txt](https://heunnajo.gitbook.io/java/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://heunnajo.gitbook.io/java/collection-framework/arr-index++-arr-index-index++.md).

# arr\[index++]과 arr\[index] index++의 차이

1. index++

```java
index = 1;
array[index] = 1;//array[1] = 1;
index++;//index = 2;
array[index] = 2;//array[2] = 2;
```

**2. arr\[index++] : index가 증가되서 들어간다. 배열의 크기가 N일 때 N+1 배열방에 접근하여 ArrayIndexOutOfBoundsException이 일어나기 때문에 array\[index++] 로 사용할 경우 배열의 크기를 +1 더해준다!!!**

```java
index = 1;
array[index++] = 1;//array[2] = 1;
array[index++] = 2;//array[3] = 2;
```
