// 请在Begin-End间编写代码
/********** Begin **********/
// 第一步:创建ExcTest类
import java.util.Scanner;
public class ExcTest {
// 第二步:创建任意方法并抛出数组越界异常
public static void ArrIndex()throws ArrayIndexOutOfBoundsException{
// 第三步:接收给定的一行字符串
Scanner scanner = new Scanner(System.in);
String s = scanner.nextLine();
// 第四步:切割字符串,得到一个数组
String[] split = s.split(",");
// 第五步:输出数组中第五个元素
System.out.print(split[4]);
}
public static void main(String[] args) {
// 第六步:调用创建的方法,捕获异常,输出数组长度小于5
try{ ArrIndex();}
catch (ArrayIndexOutOfBoundsException e){
System.out.print("数组长度小于5");
}
}
}
/********** End **********/