class arrex1
{
public static void main(String arg[])
{
try
{
int a[] = {2,4,6};
System.out.println(a[5]);
}
catch(ArrayIndexOutOfBoundsException e)
{ }
finally
{
System.out.println("\nInvalide Array Value, change the value...");
}
}
}Java
Java - Exception Handling(ArrayIndexOutOfBoundsException)

Written by
View ProfileSenthilvelan Sambamoorthy
Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.
