symbols for bitwise operators:
& ( with ): Both are 1 When I am one, the others are 0
| ( or ) : Both are 0 only when the 0 , the others are 1.
^ ( xor ): The difference between the two is 1, the same as 0
~ ( inverse ):0 becomes 1,1 becomes 0.
the representation of negative numbers: The highest bit of bits is 1, so this number is a negative.
rule: Negative number corresponding to the positive number-1 , the inverse negative number corresponding to the positive number reversed +1
Role: Data is encrypted
shift Operators :
>> Right Shift
rule: shift the number of digits to the right by dividing by 2 How many times you want to move
<< left Shift
rule: how many digits to the left, multiply the number by 2 times.
>>> unsigned Right shift
function : increases the operation rate. Bit arithmetic is the fastest execution.
features : A number A and two the same number ^, the final result is still the original number a.
Looping Statements
While loop: First judge the execution
Structure:
while ( loop condition ) {
Loop body.
}
do and loop: once executed, the loop body is bound to execute once .
structure :
bo=
circulation body ;
}while ( cyclic conditions );
For Loop:
Structure:
for (;;) {
Loop body
}
Java Object-oriented programming:
The three main characteristics of object-oriented: encapsulation, inheritance, polymorphism. Class, Object.
Object: The only thing that really exists.
Object-oriented programming (OOP) idea: is to make the description of things in computer language and the things in nature as consistent as possible.
Object-oriented Core: Find the right object to do the right thing.
How to find the right object in Java:
1.sun classes are already assigned, and you need to know these classes to create objects from custom-made classes.
2. Customize the class to create the object from the custom class.
The class contains: properties, methods.
The definition format of the class:
Class name {
Attribute (member variable): Describes the public characteristics of a thing.
Method: Describe the behavior of a thing (what to do)
}
Create an object from a custom class
Format:
Class Name Object name (variable name) = new class name ();
Creating objects from the car class
Car car = new car ();
Setting properties
Car.color = "Red";
Car.name = "BMW";
Call Method:
Car.run ();
Java Basic applications