To catch multiple exceptions in Java, use the pipe (
|) operator.Here's how you do it:
try {
// do something
} catch (NumberFormatException | IllegalStateException e) {
// handle it
}

|) operator.Here's how you do it:
try {
// do something
} catch (NumberFormatException | IllegalStateException e) {
// handle it
}