Sort out the basic descriptors and operators commonly used in Java programming

Descriptors are keywords you add to those definitions to change their meaning. The Java language has many descriptors, including the following:

Accessible descriptorjava provides a series of accessible descriptors to set the access level of classes, variables, methods and constructors. The four access levels are as follows:

By default, it is visible to the package. No descriptor is required.

Inaccessible descriptor

Java provides some inaccessible descriptors to meet other functions.

Basic operators Java provides a rich set of operators for manipulating variables. We can divide all Java operators into the following groups:

The use of arithmetic operators in mathematical expression is the same as their use in algebra. The following table lists arithmetic operators:

Assuming that there are 10 variables A and 20 variables B as a whole, then:

Example

Example

The bit operator acts on the transmission standard between binary systems and performs bitwise operations. Suppose a equals 60; B equals 13; Now in binary form, they are as follows:

The following table lists bitwise operators:

Assuming that there are 60 integer variables A and 13 integer variables B, then:

Example

Assuming that the Boolean mathematical system variable a is true and B is false, then:

Example

Example

Conditional operator (?:)

Conditional operators are also called ternary operators. This operator consists of three operands and is used to evaluate the expression of Boolean mathematics system. The purpose of this operator is to determine which values should be assigned to variables. This operator is written as follows:

The following is an example:

This will result in the following results:

Instanceof character

This operator is only used for object reference variables. This operator checks whether an object is a unique type (type or interface type). The instanceof operator is written as:

(object reference variable) instanceof (class / interface type) if the object referred to by the variable on the left side of the operator is the type or interface type on the right side and passes the is-a check, the result is true. The following is an example:

This will produce the following results:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>