Create an exception class which throws an exception if operand is non numeric in calculating modulus. Use command line arguments.
Answers
Answered by
0
class NonNum extends Exception
{
NonNum()
{ super("the value is non numeric \n"); }
}
class s06_03
{
public static void main(String ar[])
{
int a,b,c=0;
try
{
a=Integer.parseInt(ar[0]);
throw new NonNum();
}
catch(NumberFormatException e)
{System.out.println(e);}
catch(NonNum e)
{ System.out.println(e);}
}
Answered by
0
Answer:
use command line arguments). class NonNum extends Exception { NonNum() { super("the value is non numeric \n"); } }
Similar questions
History,
6 months ago
Math,
6 months ago
Science,
6 months ago
Computer Science,
1 year ago
Computer Science,
1 year ago
Chemistry,
1 year ago