like this
Try {
integer a = integer . parse int(str);
}
Catch (exception e)
System.out.println ("String conversion to integer failed");
}
After throwing an exception, if you want to handle other logic, you can write the logic in the catch statement block.
I hope I can help you, thank you