Three, operator

Source: Internet
Author: User

First, at the bottom, the data in Java is manipulated by using operators.

The Equals () method does not apply to the "basic type", the base type is directly used = = or! =.

Third, when using logical operators, you may encounter a short-circuit phenomenon, that is, once you can unambiguously determine the value of the entire expression, the rest of the expression is no longer evaluated.

The suffix character after the direct constant marks its type.

Octal number prefix 0 and the suffix 0-7 number to indicate

The hexadecimal number applies to all integer data types, prefixed by 0x, followed by 0-9 or lowercase a-f.

Five, C/c++/java, use E to denote "power of 10"

Six, bitwise operators: OR | With & non-xor ^

The non-also called counter, can only operate on one operand, so it cannot be used in conjunction with =.

Seven, the "signed" right shift operator uses "symbol extension": If the symbol is positive, then insert 0 in the high position, if the symbol is negative, insert 1 in the high position

A new "unsigned" Right shift operator (>>>) is added to Java, which uses the "0 extension": both positive and negative inserts are inserted at high positions 0

If a value of char, Byte, or short is shifted, it is converted to an int type before being shifted, and the resulting result is also a value of type int.

A Long value is processed, and the resulting result is a long type.

If you perform such a shift operation on a byte or short value, you may not get the correct result.

Eight or three-dollar operator If-else He is one of the operators because it will eventually generate a value

Boolean-exp? Value0:value1

If the result of Boolean-exp is true, the VALUE0 is computed, and the result of the expression is the value of the operator and vice-versa.

Nine, + and + + have a special purpose in Java, which is the connection string

If the expression starts with a string, all subsequent operands must be of type string

You can use an empty string followed by + and a basic type of variable to perform the conversion of the string

Ten, in the type conversion, the narrowing conversion may face the risk of information loss, in the narrowing conversion, you must pay attention to the truncation and rounding problems, such as 27.6 converted to int when the result is 27

Typically, the largest data type that occurs in an expression determines the data type of the final result of the expression.

Xi. no sizeof in Java

Three, operator

Related Keywords:

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.