Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the operators of Java

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is mainly about "what are the operators of Java". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "what are the operators of Java"?

I. operator

1. Arithmetic operator

+ addition

-subtraction

* multiplication

/ division (division of integers can only get the result of integers. In order to get a decimal, one party involved in the operation must be a decimal)

% surplus

+ + self-increasing

-self-subtraction

Used alone: + and-have the same effect in front of and after the variable. All allow variables to increase or decrease.

Participate in the operation to use:

If + + or-is placed in front of the variable, it is self-increasing or self-decreasing before assigning a value.

If + + or-is placed after the variable, it is used with the original value first. And then increase or subtract.

Sample code

two。 Characters participate in + sign operation

When the character participates in the operation, the corresponding code table value is used for the operation.

'A' 65'a'97'0' 48

Data type conversion rules when different data types participate in the operation

Byte, short, char- > int- > long- > float- > double

Sample code

3. String participates in + sign operation

A string concatenated with a + sign with any data type will form a new string

The string is in front of it, and what we do is string concatenation.

The string is at the back, do the previous operation first, and then concatenate with the string

Sample code

4. Assignment operator

= assignment

+ = perform addition operation and then assign a value

-= subtract and then assign a value

* = perform multiplication and then assign a value

/ = divide and then assign a value

% = take the remainder and then assign the value

Sample code

5. Comparison (relational) operator

Greater than >

Less than =

Less than or equal to

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report