Is it a good idea in Java to OR exceptions in catch block?

Pho*_*nix 0 java

Should we OR exceptions like this ?

catch (final CustomExceptionA | CustomExceptionB e) {

       Should we catch expections like this ? 
    }
Run Code Online (Sandbox Code Playgroud)

Bud*_*ddy 6

如果你想以完全相同的方式处理它们,这是一个很好的方法.它也只能在Java 7(及更高版本)上编译.