class Exception3
{
public static void main(String[] args)
{
if (Integer.parseInt(args[0]) == 0)
throw new Exception("Invalid Command Line Argument");
}
}
*The error involves an OutOfBoundsException
class Exception3
{
public static void main(String[] args)
{
if (Integer.parseInt(args[0]) == 0)
throw new Exception("Invalid Command Line Argument");
}
}
*The error involves an OutOfBoundsException
Your question is very vague, but are you looking to do something like this? I assume this is a java related question.
This uses a try catch to attemt to parse the int. If an exception is thrown by the parseInt function than the catch block will catch the exception.