In Java, I want to do something like this:
try {
...
} catch (/* code to catch IllegalArgumentException, SecurityException,
IllegalAccessException, and NoSuchFieldException at the same time */) {
someCode();
}
...instead of:
try {
...
} catch (IllegalArgumentException e) {
someCode();
} catch (SecurityException e) {
someCode();
} catch (IllegalAccessException e) {
someCode();
} catch (NoSuchFieldException e) {
someCode();
}
Is there any way to do this?
bitwise or
(|
) operator? Why not use a comma, or the operator that has a more similar meaning, thelogical or
(||
)? – Winniewinnifred