Basic Java Language: Difference between revisions
wikademia>Crossbow9 |
wikademia>Crossbow9 |
||
| Line 91: | Line 91: | ||
Unlike the = operator, a statement that simply uses the addition operator and two other values on either side does not do anything significant. For example, neither of the following three lines of code do anything. | Unlike the = operator, a statement that simply uses the addition operator and two other values on either side does not do anything significant. For example, neither of the following three lines of code do anything. | ||
<pre>5 + 6; | <pre>5 + 6; | ||
a + 9 | a + 9; | ||
a + b </pre> | a + b;</pre> | ||
If you want to you want to use the addition operator to add 6 to the value of ''a'', it would be used like this: | If you want to you want to use the addition operator to add 6 to the value of ''a'', it would be used like this: | ||
</pre>a = a + 6;</pre> | </pre>a = a + 6;</pre> | ||