Computer Science, asked by bhatiaaditi7109, 1 year ago

Create an exception class which throws an exception if operand is non numeric in calculating modulus. Use command line arguments.

Answers

Answered by Anonymous
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 Ritikakinha1234
0

Answer:

use command line arguments). class NonNum extends Exception { NonNum() { super("the value is non numeric \n"); } }

Similar questions