Java basic data operators and expressions

Operator

(1) Arithmetic operators (+,-,/,%,++,- -,**),;
(2) Relational operators (>,<,>=,<=,–==,!=) ;
(3) Logical operators (&&,||,!);
(4) Bitwise operators (>>,<<,>>>,&,^,|,~);
(5) Assignment operators (= ,+=,-=,*=,/=);
(6) Conditional operator (?:);
(7) Other operators.

Character (string) addition

1. The use of addition symbols
2. The addition of normal numerical valuesInsert picture description here
Insert picture description here

Increase and decrease

1. Use alone;
2. Mixed use with printing
Insert picture description here
Insert picture description here

Arithmetic and relational operators

< != >= <=
Insert picture description here

Insert picture description here

Logical Operators

Logical operators include:
&& short circuit with 1. Both sides are true, the result type is true 2. One side is false, the result type is false Short-circuit characteristics: the left side of the symbol is false, and the right side is no longer calculated
Short-circuit and or 1. Both sides are false, the result is false 2. One side is true, the result is true Short circuit characteristics: the left side of the symbol is true, and the right side is no longer calculated
! Negate 1.! The true result is false 2.! false result is true

Note: Logical operator is used to connect two Boolean type result operators, the result of the operation is Boolean true or false

Insert picture description here

Insert picture description here

Conditional operator

a=5; unary operator;
5+3; binary operator
;? : Ternary operator;
Insert picture description here
Insert picture description here

Big Data 2003 Student ID: 2020080603020

Guess you like

Origin blog.csdn.net/weixin_55680204/article/details/114785113