In java 7 we can catch multiple exceptions at a time like
try {
Class a = Class.forName("wrongClassName");
Object instance = a.newInstance();
} catch (ClassNotFoundException | IllegalAccessException |
InstantiationException ex) {
System.out.println("Failed to create instance");
}
Is this Bitwise Inclusive OR? Bitwise operators are used to compare binaries as far as I know in java.
If it is not, then how java differentiates this operator with Bitwise Inclusive OR??
Just want to know the name of the operator used here and is this operator exists before java 7.
Any answer is appreciated. Thanks.
It’s valid since Java 7, and I call it a pipe.
The catch block itself is called a multi-catch block.
Depending on the context where it’s used, this operator is a bitwise or, or a multi-catch operator. Just like in
(1 + 1)the+is the addition operator, and in"hello" + "world", the + is the concatenation operator.