Code:
class err6
{
public static void main(String[] args) { int i;
try
{
System.out.println("Command line arguments are:");
for (i=0;i<5 ;i++ )
{
System.out.println(Integer.parseInt(args[i]));
}
}
catch(NumberFormatException e)
{
System.out.println("Invalid data."); System.out.println("Type of error:"+e);
}
catch(ArrayIndexOutOfBoundsException e1)
{
System.out.println("Array overflow."); System.out.println("Type of error:"+e1);
}
finally
{
System.out.println("I am always there.");
}
}
}
Output:-
0 Comments