Java官方教程(三-5)运算符小结(2020.12.22)

前言

本文是橙子出于兴趣爱好对Java官方教程的尝试翻译,几乎每日更新,感兴趣的朋友可以关注一下橙子;翻译过程中尽可能多的对一些关键词保留了英文原文,如果你想看最纯正的英文原版教材却又看不懂,可以试着来看一下橙子的翻译版啊,欢迎大家留言讨论,冲鸭!
更多相关文章点击阅读
Java官方教程目录2020最新版

运算符 operators

运算符小结 Summary of Operators

下面总结了Java语言支持的运算符。

简单赋值运算符 Simple Assignment Operator

=       Simple assignment operator

算术运算符 Arithmetic Operators

+       Additive operator (also used    //加法运算符(也用于用于字符串连接)
        for String concatenation)
-       Subtraction operator
*       Multiplication operator
/       Division operator
%       Remainder operator  //求余运算符

一元运算符 Unary Operators

+       Unary plus operator; indicates  //一元加法运算符;表示正值(没有+,也默认为正值)
        positive value (numbers are 
        positive without this, however)
-       Unary minus operator; negates  //一元减法运算符;否定表达式
        an expression
++      Increment operator; increments  //递增运算符;将值增加1
        a value by 1
--      Decrement operator; decrements  //递减运算符;将值增加1
        a value by 1
!       Logical complement operator;  //逻辑补码运算符;反转布尔值
        inverts the value of a boolean

相等和关系运算符 Equality and Relational Operators

==      Equal to
!=      Not equal to
>       Greater than
>=      Greater than or equal to
<       Less than
<=      Less than or equal to

条件运算符 Conditional Operators

&&      Conditional-AND
||      Conditional-OR
?:      Ternary (shorthand for 
        if-then-else statement)

类型比较运算符 Type Comparison Operator

instanceof      Compares an object to //将object与指定类型比较
                a specified type 

位和位移运算符 Bitwise and Bit Shift Operators

~       Unary bitwise complement
<<      Signed left shift
>>      Signed right shift
>>>     Unsigned right shift
&       Bitwise AND
^       Bitwise exclusive OR
|       Bitwise inclusive OR

练一练

在这里插入图片描述
参考答案
在这里插入图片描述
(ps:所有的章节的问题,橙子都是直接用的英文,感觉这样可以更好地帮助大家理解,其实大家只要耐心点,都可以看懂的)

想系统学习Java的朋友关注一下橙子,相信会有意想不到的收获鸭!

猜你喜欢

转载自blog.csdn.net/weixin_42509923/article/details/111504200