배열 크기 및 두 숫자를 입력받아 예외가 발생하면 이를 처리하는 문제입니다 이를 해결하는 다음 프로그램에 대해 빈칸을 채우세요
1) apple 2) banana 3) carrot 배열 허용 범위 초과 빈 객체 접근 오류
import java.util.*;
public class ReferenceExceptions
{
public static void main( String args[] ) {
String[] word = { "apple", "banana", "carrot" };
{
for( int index = 0; index <= word.length; index++ ) {
System.out.println( ( index + 1 ) + ") " + word[ index ] + " " );
}
}
( e ) {
System.out.println( "\n배열 허용 범위 초과" );
}
{
word = null;
System.out.println( word[0] );
}
( e ) {
System.out.println( "빈 객체 접근 오류" );
}
}
}