public class ArrayTesting
{
public static void main(String[] args)
{
int arr[]= new int[2];
arr[0]=1;
arr[1]=2;
int res;
try
{
res = arr[0] + arr[1] + arr[2];
System.out.println("Sum is : " + res);
}
catch(IndexOutOfBoundsException exception)
{
System.err.println("Exception : " +exception);
}
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.