Tij English original book reading tour--chapter three:operators

Source: Internet
Author: User

Operators

This section is relatively simple, so make some notes simply:

Several points:

1. When the compiler sees a String followed by a "+" followed by a non-string, it attempts to convert the non-string into A String.

2. Compare the contents of the object using the Equals () method, provided that the class that corresponds to the object overrides the Equals () method in the object class, and implements a comparison of the objects ' contents. Most classes in the Java class Library override the Equals () method, so they compare the contents of the object, not the reference.

3, you can ' t use a non-boolean as if it were a Boolean is a logical expression as you can in C and C + +.

4, once the value of the logical expression can be determined to be true or false, then the rest of the logical expression is not executed, we call the "short circuit principle."

5. When you convert a float or double value to an integer value, the number is truncated. If you are rounding to an integer value, you can use the round () method of the math class in the Lang package.

6. Do mathematical operations or shift operations on native data types smaller than the shape of the shape, and their values are automatically promoted to shaping before the operation is performed. Generally, the largest data type in an expression is the type of the result.

7. In addition to the Boolean type, two-way conversions can be made between any two native data types.

8, for floating-point numbers, there is no special designation (such as suffix f), the compiler will treat it as a double value.

Tij English original book reading tour--chapter three:operators

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.