The plus sign ( ) in Java has two uses: arithmetic operator (used to add two numbers) and unary increment operator (used to increment a variable value).
Plus sign ( ) in Java
In Java, there are two types of plus sign ( ) operator Usage:
1. Arithmetic operator
int sum = 10 20;
will add 10 and 20 and store the result (30) in the sum
variable. 2. Unary increment operator
int count = 5; count ;
will increment the value of count
from 5 to 6, and then return 6. Example:
<code class="java">int x = 10; int y = ++x; // y = 11, x = 11 int z = y++; // z = 11, y = 12</code>
Note:
The above is the detailed content of What does + mean in java. For more information, please follow other related articles on the PHP Chinese website!