什么是|的名字java中的运算符 [英] What is name of | operator in java

查看:60
本文介绍了什么是|的名字java中的运算符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在java 7中,我们可以一次捕获多个异常,例如

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");  
}  

这是Bitwise Inclusive OR吗?就我在java中所知,按位运算符用于比较二进制文件。
如果不是,那么java如何用Bitwise Inclusive OR区分这个运算符?

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??

只想知道这里使用的运算符的名称,这个运算符是否存在于java 7之前。

Just want to know the name of the operator used here and is this operator exists before java 7.

任何答案都表示赞赏。谢谢。

Any answer is appreciated. Thanks.

推荐答案

它自Java 7开始有效,我称之为管道

It's valid since Java 7, and I call it a pipe.

catch块本身称为多捕获块。

The catch block itself is called a multi-catch block.

根据使用它的上下文,此运算符是按位的或者,或多捕获操作员。就像在(1 + 1)中一样, + 是加法运算符,在中你好+世界,+是连接运算符。

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.

这篇关于什么是|的名字java中的运算符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆