Friday, April 12, 2019

exception handling

public class cl {
 public static void main(String args[]) {
int a[]=new int[5];
a[10]=50; //ArrayIndexOutOfBoundsException
  System.out.println("End Of Main");
 }
}



$javac cl.java
$java -Xmx128M -Xms16M cl
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 10
 at cl.main(cl.java:4)

No comments:

Post a Comment