[Thinking in JAVA] operator

Source: Internet
Author: User
Tags bitwise operators

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
    1. 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;
    2. 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
  1. + 、-、 *,/,%, + =,-=, *=,/=,%=
  2. + + 、--(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)
  3. >, <, >=, <=, = =,! = (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)
  4. &&, | |,! (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)
  5. Direct constants: Float (f/f), double (d/d), Long (l/l), Hex (0x), octal (0), floating point (1.1e-5f)
  6. Bitwise operators:&, |, ^, ~, &=, |=, ^=
  7. Shift Operations:>>, <<, >>>, >>=, <<=, >>>=
  8. Ternary operator: Boolean-exp? True-value:false-value
  9. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.