ArrayIndexOutOfBoundsException
- Array 변수의 특정 번째에 데이터가 없는 경우, 즉 Array변수의 데이터가 0부터 7까지 있는데 8번재의 데이터를 찾으려고 시도 할때 발생되는 에러 입니다.
Example Source
public static void main(String[] args) {
   try{
      int value;
      int array[] = {6, 16, 26,36,46,56,66,76};
     int index = 8;
      value = array[index];   // <-- 여기서 발생
      System.out.println("Execution does not reach here if there is a invalid index.");
   }catch(ArrayIndexOutOfBoundsException e){
      System.out.println( "Valid indexes are 0, 1,2,3, 4,5,6 or 7" );
   }
 }
 
 출처 : http://doplait.springnote.com/pages/6458459

'Java' 카테고리의 다른 글

우선순위 큐(Priority Queue)와 힙(Heap)  (0) 2011.05.02
Collection  (0) 2011.05.02

+ Recent posts