Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What are the common operators in java

Shulou Source: shulou.com Published: 2022-06-01 12:38:50 09月26日 Update

This article mainly shows you "what operators are commonly used in java", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what operators are commonly used in java" this article.

Symbols that operate on constants and variables are called operators

Expressions that use operators to concatenate constants or variables to symbolize java syntax can be called expressions.

Expressions joined by different operators represent different types of expressions.

For example: define two variables of type int, amemb, and do addition (a + b)

Common operators:

Arithmetic operator

Assignment operator

Relational operator

Logical operator

Ternary operator

Today we focus on arithmetic operators:

Basic arithmetic operations

It is nothing more than addition, subtraction, multiplication, division and remainder.

For example:

Usage of%

What  gets is the remainder of two divisible data.

The use of : to judge whether two data are divisible

Multiple uses of +

Addition of  numbers (this is the most commonly used mathematical calculation)

 character addition: using characters to store the corresponding data values in the computer to participate in the operation.

You can see that the final output is 108 and 107. If you subtract 10 from the corresponding value, you will get the value of the character type, which are commonly used and need to be kept in mind:

'0'-> 48

'1'-> 49

'a'- > 97

'b'-> 98

'After music-> 65

The last is the addition of strings:

The + here is not really an addition, but a string concatenator; strings and other types of data

Do splicing, the result is a string type

/ / this symbol represents comments, which are generally needed to make your code clearer.

Of course, if you write thousands of lines of code without adding a comment, you look like you'll struggle later.

The above is all the contents of the article "what are the commonly used operators in java?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Operations operators characters commonly used strings data types two content variables comments symbols arithmetic articles differences codes additions constants formulas results Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple MariaDB Docker macOS MySQL