I know since Java 7 you can use multi-catch
but I wonder if the order of exceptions in it matters like in previous versions of java? E.g I put in Exception and then SQLException
and IOException
?
try {
// execute code that may throw 1 of the 3 exceptions below.
} catch(Exception | SQLException | IOException e) {
logger.log(e);
}
Or should I do it this way ?
try {
// execute code that may throw 1 of the 3 exceptions below.
} catch(SQLException | IOException e) {
logger.log(e);
} catch(Exception e) {
logger.severe(e);
}