您的位置 首页 java

小宗学编程(七)Java学习入门

分享兴趣,传播快乐,增长见闻,留下美好!亲爱的您,这里是LearningYard新学苑。今天小编为大家带来“Java学习入门”,欢迎您的访问。

Share interests, spread happiness, increase knowledge, and leave good news! Dear you, this is the new LearningYard Academy. Today, Xiaobian brings you “Introduction to Java Learning”, welcome your visit.

Java学习入门—— 运算符

运算符

运算符是一种特殊的符号,用以表示数据的运算、复制和比较等。大致分为六类: 算术运算符 、赋值运算符、比较运算符、逻辑运算符、 位运算符 三元运算符

1.算术运算符

①取余运算中结果与被模数的符号相同。

②开发中经常使用%来判断能否被除尽的情况。

③自增1(减1)运算不会改变本身的数据类型

小宗学编程(七)Java学习入门

An operator is a special Symbol used to represent data operations, copying, and comparisons, etc. There are roughly six categories: Arithmetic operators, assignment operators, comparison operators, logical operators, bitwise operators, and ternary operators.

1. Arithmetic operators

① The result of the remainder operation has the same sign as the module.

②In development, % is often used to judge whether it can be eliminated.

③The operation of incrementing by 1 (minus 1) will not change its own data type

2.赋值运算符

符号:=

①当“=”两侧的数据类型不一样时,可以使用自动类型转换或强制类型转化原则处理

②支持连续赋值

③扩展赋值运算符:+=、-=、*=、/=、%=(扩展赋值运算符在计算时不会改变变量本身的数据类型)

小宗学编程(七)Java学习入门

小宗学编程(七)Java学习入门

小宗学编程(七)Java学习入门

2. Assignment operator

Symbol: =

①When the data types on both sides of “=” are different, you can use the principle of automatic type conversion or forced type conversion.

②Support continuous assignment

③ Extended assignment operator: +=, -=, *=, /=, %= (the extended assignment operator does not change the data type of the variable itself during calculation)

3.比较运算符

比较运算符的结果都是 boolean 型,也就是要么是true,要么是false。

比较运算符包括:==(相等于) !=(不等于) <(小于) >(大于) <=(小于等于) >=(大于等于)

小宗学编程(七)Java学习入门

3. Comparison operators

The results of comparison operators are all boolean, that is, either true or false.

Comparison operators include : == (equal to) != (not equal to) < (less than) > (greater than) <= (less than or equal to) >= (greater than or equal to)

今天的分享就到这里了。如果您对今天的文章有独特的想法,欢迎给我们留言,让我们相约明天,祝您今天过得开心快乐!

That’s it for today’s sharing. If you have a unique idea about today’s article, Welcome to leave us a message. Let us meet tomorrow, I wish you a happy day today!

END

翻译:来自Googl翻译

本文由LearningYard新学苑原创,欢迎关注,带你一起长知识。

排版:谢宗佑

文字:谢宗佑

审核:李小雪

文章来源:智云一二三科技

文章标题:小宗学编程(七)Java学习入门

文章地址:https://www.zhihuclub.com/190639.shtml

关于作者: 智云科技

热门文章

网站地图