
1.Create a class Errorhandle1. Write code that deliberately throws the following exceptions, without using the ââ?¬Å?throwââ?¬Â? keyword ClassCastException NullPointerException ArrayIndexOutOfBoundsException StackOverFlowException AssertionError NumberFormatException

//ArrayIndexOutOfBoundsException
class ExceptionExample
{
public static void main(String[] args)
{
try{
int a[] =new int[6];
for(int i = 0; i<7; i++){
a[i]=i;
}
}catch(Exception e){
System.out.println("Exception:"+e);
}
}
}
//NumberFormatException
public class ExceptionExample {
public static void main(String args[]) {
try {
String st="rose";
int num=Integer.parseInt(st);
System.out.println(num);
} catch(Exception ex) {
System.out.println(ex);
}
}
}