**Addition (+)**- is the operation of adding operands to get their sum, the symbol plus (+) is used to denote this**Subtraction (-)**- is the operation for subtracting the value of one operant from the other, the symbol minus (-) is used to denote this**Multiplication (*)**- is the operation for getting the product of the operands and is denoted by the symbol asterisks ***Division (/)**- is the operation that divides a number with another number and is denoted by the symbol /**Modulus (%)**- us the operation that gets the integral remainder when one number is divided by another, it is denoted by the symbol percent (%)

The symbol plus (+) is used as the symbol for addition. This operator when used, means to add the number from it's left and right. For example:

System.out.println(1 + 2);

The symbol + is between the numbers 1 and 2. Hence the statement above means to add the number from the left and right of the symbol plus, which gives us the answer 3. Below is the output of the above code:

3The above code shows example on how to add two numerical literals. We can add variables too:

int a = 2; int b = 3; System.out.println(a + b);The above example uses two variables a and b with values 2 and 3. The plus sign is then applied on both numbers, by putting it in their middle, giving us the below answer:

5The last example below mixes adding literal and variable numbers:

int a = 5; System.out.println(a + 8);So we have a variable a with value 5 and we use the plus symbol to add variable a with the number 8. The program will output the answer below:

13

The minus (-) symbol is what we typically use to denote addition in Java. This symbol is typically shown between values of two numbers, and it means to subtract the value of the right from the left. Below is a simple example to explain how it works:

System.out.println(5 - 2);

The number to the right of the minus symbol is 2 and the number to the left is 5. It means subtract the value from the right which is 2, from the left which is 5, that will result to the value 3. Hence the output of the code is shown below:

3The first example shows how to do subtraction from two literal values. Below is an example on how to do this on variables:

int a = 10; int b = 5; System.out.println(a - b);And similar to discussed above, we subtract the value of variable b which is 5 from the variable a on the left which has the value of 10. The result is shown below:

5And last example is subtraction between literals and variables, which is also allowed in Java.

int a = 21; System.out.println(a - 8);So again, we subtract the value from the right of the minus sign which is 8, from the value from the left which is the variable a with value 21. The result is shown below:

13

Multiplication is a more processing intensive operation that addition and subtraction. But this is necessary for many of our programs, so that we don't need to do loop in some situations. This asterisk symbol (*) is used to denote a multiplication operation, which means to multiply the value to the left and right of the symbol For example:

System.out.println(2 * 3);

Here Java sees the asterisk and the left side has the value 2 and the right side is 3. The two are multiplied generating the result shown below:

6The code we shown above again, shows two literals in action. We show the counterpart in variables:

int a = 5; int b = 3; System.out.println(a * b);So again, the value to the left and right of the symbol asterisk is multiplied. Which are the values of the variables a and b, which are 5 and 3. The result is shown here:

15Lastly, we mix again variables and literals to show that we can do it in Java:

int a = 4; System.out.println(a * 8);So the symbol asterisk has a to the left and literal 8 to the right. So we multiply the value of a which is 4 to the literal 8, that will result to:

32

Unlike multiplication, the position of the operant in division is very important. The symbol used for division is /, and the left value is the one we will divide by the value to the right. Example:

System.out.println(8 / 2;

So the above code wants to divide 8 by 2, because 8 is to the left and 2 is to the right. Hence the result is below:

4We try an example with variables:

int a = 10; int b = 5; System.out.println(a / b);So similarly, we want to divide a because it is on the left side, with the value of b which is on the right side. So we divide 10 by 5, that will result to:

2Lastly is we combine variables and literals:

int a = 21; System.out.println(a / 7);So the value of a which is 21, will be divided by the literal 7. So we are dividing 21 by 7 in this example, which gives us:

3

System.out.println(5 % 2);

So similarly, it is like dividing the left side which is 5, by the right side which is 2. So when we divide 5 by 2, the remainder is 1. Which is exactly the result of the code as shown below:

1Applying it to variables is given below:

int a = 11; int b = 5; System.out.println(a % b);So it is like dividing a with b, which is dividing 11 by 5. The operation will leave a remainder of 1, which is shown below:

1And lastly, we show mix of variable and literal example:

int a = 18; System.out.println(a % 5);We are dividing a with 5, which is dividing 18 with 5. The remainder is 3.

3

- Setup Your Windows Development Environment
- Read Input From Console
- Simple Hello World Java Application
- Variables and Assignment Statements
- Primitive Types
- Basic Arithmetic Operators
- Assignment Operators
- Compound Assignment Operators