[Video] beginner course-operators-Java J2se,-javaj2se
This section mainly describes the application of operators.
Java operators include:
Arithmetic Operators
Value assignment operator
Logical operators
Bitwise operators
Ternary Operators
Here we have recorded videos to explain these operators and provided you with exercises.
Interview Questions:
1. What is the most efficient way to calculate the value of 2 multiplied by 8?
2. Swap the values of Two integer variables (third-party variables are not required)
The answer is posted on the official website forum-Lesson 3 after-school exercises
Www.xiaozhangwx.com
Video address:
Http://my. TV .sohu.com/us/233850565/75540081.shtml
======================================
This course is offered by Xiao Zhang.
More free videos:
Www.xiaozhangwx.com
Or Q group: 97785507
======================================
Logical operators in JAVA
Iii. logical operators:
& (And) | (OR )! (Reverse)
&: When both sides are true, the result is true. Otherwise, the result is false.
|: If either side is true, the result is true. Otherwise, the result is false.
! : True Value to false value, false value to True Value
I have been learning JAVA for a short time. I have been developing JAVA for more than a year, but I cannot remember the basic knowledge you have mentioned. I was so scared at the beginning that I forgot to learn it.
But it tells you that JAVA is not backed up, but logic.
In terms of memory, you only need to know where to view it.
That's why there are so many API reference and so on.
Explanation of java median Operators
There are more operators.
Arithmetic Operators +-*/% are addition, subtraction, multiplication, division, and remainder
Here, we should pay special attention to the promotion phenomenon. It refers to the three types lower than int (byte short char), which will be automatically upgraded to the int type column after arithmetic operation, such
Byte a = 20;
Byte B = 30;
Byte c = a + B; // the error message should be written as byte c = (byte) (a + B); or int c = a + B;
Comparison Operators
That is, <,>, <=, >=, = ,! = Respectively is less than, greater than, less than or equal to, greater than or equal to, not equal
The result is a Boolean type.
Logical operators
Or (|) and (&) are not (!) Or and not
Value assignment operator
The simplest thing is that "=" is used to specify values for constants or variables. Note that values cannot be assigned to the formula.
Other assignment operators are as follows:
+ = Add the variable to the right and assign it to itself.
-= Equal subtraction: subtract the value on the right of the variable and assign the value to itself.
* = Multiply the variable by the value on the right and assign it to itself.
/= Divide the variable by the value on the right and assign the value to itself.
% = Perform remainder operation on the variable and the value on the right, and then assign the value to itself.
There are also binary Operators
Bitwise operators
Shift operator ....
++ Increment
-- Decrease
Condition? Value 1: Value 2 Conditional Operators