Java basic operator: + 、-、 *,/,%, =, = =,! =, + =,-=.
Priority: First multiplication after the addition and subtraction, if the connector + number will be prioritized forward matching, such as a+++++b, will be interpreted as a++ + + +b, so will error, you need to use parentheses to isolate (a++) + (++b).
Object references If you assign a reference to an object, 2 objects will point to the same reference, and one object's reference will be re-assigned to another object, such as
ClassName ClassA = new ClassName ();
ClassName ClassB = new ClassName ();
ClassA = ClassB;
classa.x = xxx;
Then classb.x also for XXX.
Relational operators:<, >, <=, >=, = =,! =, equals ().
Equals () is used primarily to compare the contents of an object, not a reference to an object (the result is always false if compared).
Logical operator:&&, | | 、!。
Operation Short-circuit: If the logical operator && in the connection of multiple judging conditions, there is a condition that does not match the result is directly inconsistent, if the match must be judged that all conditions are met.
Direct constants:
front (rear) suffix |
|
l |
|
f |
float |
d
double |
hex
0 (0~7) |
octal |
Exponential notation: E represents the power of 10.
Bitwise operators:
operator
|
two operand median is 1, result is 1, otherwise the result is 0 |
or (|) |
Two bits as long as one is 1, then the result is 1, otherwise 0 |
TD width= "442" style= "margin:0px;" > Two operands, the same result is 0, the result is 1
non (~) |
|
Shift operators: Left shift operator (<<), right shift operator (>>), unsigned Right shift operator (>>>).
Operator Overloading: +, + =.
Type conversion operators:
The extended conversion (int->float) can not explicitly indicate the type of conversion, and the narrowing conversion (Float->int) must specify the type of the cast to indicate the expected;
The principle of rounding is not performed when casting a type, and the tail is always truncated;
You can use Math.Round (XXX) to achieve rounding effect;
When used with the "large" type and the "small" type, the program defaults to the "large" type for unification, such as int and long, and the result is long.
All Java data types are the same size in all machine stores (see Java Learning Note 2), so no sizeof () is required to calculate.
Long press attention "I'm Programming"
650) this.width=650; "Src=" https://mmbiz.qlogo.cn/mmbiz_png/ Rkgihvg2qb2d5owd8xepal427uv7f6updiaiag7disuyrcwfa0zonkdqa5jfhw0v0dz7kzrtowb7uk9bxvibcqyibq/0?wx_fmt=png "style= "Margin:0px;padding:0px;height:auto;" alt= "0?wx_fmt=png"/>
See more | How to Think | More Practice
No Kuibu, not even thousands of miles.
This article is from the "I am Programming" blog, please be sure to keep this source http://sylan215.blog.51cto.com/681991/1923856
Java Learning Note 3-operators