Sep
09
class TestEx{
public static void main(String args[]){
try{
if(args.length==0){
String s=null;
System.out.println(s.length());
}
System.out.println(args[0].length());//3
int num1=Integer.parseInt(args[0]);
int num2=Integer.parseInt(args[1]);
System.out.println(num1/num2);
}
catch(NullPointerException e){
System.out.println(e);
}
catch(ArrayIndexOutOfBoundsException e){
System.out.println(e);
}
catch(ArithmeticException e){
System.out.println(e);
}
catch(NumberFormatException e){
System.out.println(e);
}
catch(Exception e){
System.out.println(e);
}
System.out.println(“exit from main”);
}
}
Leave a Reply
No Comments