[Java_Error] Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
·
Trouble Shooting(Error)
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException ex) Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 5 out of bounds for length 4 at ForeachDemo.main(ForeachDemo.java:10) > 에러 발생 이유 : 배열이 가지고 있지 않은 인덱스를 가지고 오려고 할 때 발생하는 오류 > 길이가 4인 배열에서 인덱스 5 값을 가지고 오려해서 발생하는 오류 > 해결 방법 : 배열의 length를 확인 후 인덱스 값을 변경하기