3 operator3.1 Static Import
You can statically import static methods and variables so that you can invoke static methods and variables in the class without writing the class name;
Package Com.chenlei.study.thinkinginjava; Import Static java.lang.System.out; Import Static java.lang.Integer.parseInt; Public class Staticimport { publicstaticvoid main (string[] args) { Out.println (); parseint ("123");} }
3.2 Object references and value passing
- Object A, B,a=b, indicates that a reference to the B object is passed to a at which point A and B refer to the same object, and the members of either A and B are modified to be members of the same reference;
- The underlying type A, b,a=b means that the value of B is assigned to a, and the values of A and B are equal, but not to the same reference, and modifying the value of any of the variables in A and B will result in a!=b.
3.3 operator
- + 、-、 *,/,%, + =,-=, *=,/=,%=
- + + 、--(note the difference before and after: put in front of the first to calculate the value of the return, put after the first value returned to calculate)
- >, <, >=, <=, = =,! = (Note the = = and equals methods of the object: = = Indicates whether the referenced object address is the same, equals indicates whether the content of the two objects is the same (PAN), and also note the Java Constant pool technology)
- &&, | |,! (Short circuit: When the value of an expression can be accurately obtained in a certain judgment, the remainder of the expression is not executed, such as a| | b, if A is true, it can be judged that the entire expression is true and expression B will not execute)
- Direct constants: Float (f/f), double (d/d), Long (l/l), Hex (0x), octal (0), floating point (1.1e-5f)
- Bitwise operators:&, |, ^, ~, &=, |=, ^=
- Shift Operations:>>, <<, >>>, >>=, <<=, >>>=
- Ternary operator: Boolean-exp? True-value:false-value
- string concatenation: +, + = (as long as one of the expressions in the concatenation is a string, the entire expression will return a string)
[Thinking in JAVA] operator