2:47 am - Friday April 19, 2019

Program for array out of bound Exception

Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

//*@author :CandidJava.com

//*@descriptions : This program explain the function and use of ArrayOutofBound Exception

class ArrayException {

public static void main(String[] args)  {

//The exception should be define under the Try-Catch block

Try  {

//Initialize an array with the size of 2

int []a= new int[2];

//from the array list t calls the third index variable so it calls exception



//The array indexoutofbound exception is passed

catch(Exception e){

System.out.println( e);





D:\Candid Java\Util\Exception>javac ArrayException4.java

D:\CandidJava\Util\Exception>java ArrayException4

java.lang.ArrayIndexOutOfBoundsException: 3  */

Filed in: Z-A All Java Codes

No comments yet.

Leave a Reply