0
How to catch multiple exceptions in a single catch block in Java?
I am using a try catch block and I dont want to use the method to catch Exception to catch all types of exceptions and I want to display the same message for all types of errors. Is there any way to catch multiple exceptions in a single catch box?
3 Antworten
+ 1
You can use one try block and some catch for example
try {
//}
catch(one exception){}
catch (second exception) {}
...
+ 1
if you want to display the same message for each error i don't see an issue with using:
try{}catch{}
0
Or just simply go on:
try{}
catch(Exception e){}
It cathes every exception thats being thrown