Source: http://www.imooc.com/code/1278
An operator is a "function" symbol that informs Java about the operation. For example, if we need to set the value of the variable age to 20, we need a "=" to tell the program that it needs to be assigned.
The common operators in the Java language can be divided into the following types:
Ø arithmetic operators
Ø assignment operator
Ø comparison Operators
Ø logical operators
Ø conditional operator
Task
Let's try to look at the use of operators in a simple example!
When calculating the sum of two numbers, you need to use the addition operator. In Java, the addition operator uses "+" to denote
In the editor, line 5 enters:
int sum = a + b;
Check the results of the operation:
1 Public class helloworld{2 Public Static void Main (string[] args) {3 int a=12; 4 int b=24; 5 6 System.out.println ("Sum of two numbers:" + sums); 7 }8 }
Web-android Engineer first-3-1 what is an operator