๐ Day 6 of My Automation Journey โ Operators in Java
Source: Dev.to

What is an Operator?
An operator is a special symbol used to perform operations on variables and values.
- Operator โ Symbol
- Operand โ The value on which the operator acts
Example
int total = 10 + 5;
Assignment Operator (=)
Used to assign values to variables.
int tamil = 10;
int english = 2;
Arithmetic Operators
Used for mathematical calculations.
| Operator | Meaning |
|---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
% | Modulus (Remainder) |
Example
System.out.println(tamil + english); // 12
System.out.println(tamil - english); // 8
System.out.println(tamil * english); // 20
System.out.println(tamil / english); // 5
System.out.println(tamil % english); // 0
Unary Operators
Unary operators work on a single variable.
| Operator | Type |
|---|---|
++ | Increment |
-- | Decrement |
Post Increment (age++)
Uses the value first, then increments.
Pre Increment (++age)
Increments first, then uses the value.
Example
int age = 10;
System.out.println(age++); // 10
System.out.println(age); // 11
System.out.println(--age); // 10
Equality & Relational Operators
These operators compare two values.
| Operator | Meaning | Example |
|---|---|---|
== | Equal to | a == b |
!= | Not equal to | a != b |
> | Greater than | a > b |
= | Greater than or equal to | a >= b |
| ` b); // true | ||
| System.out.println(a = b); // true | ||
| System.out.println(a 18 && age 25 | age 18)); // false |
## Trainerโs Complex Expression โ Detailed Breakdown
```java
int a = 5;
int b = 7;
int c = 10;
int result = a++ + a-- - --a + --b - ++c - --c;
Initial Values
a = 5b = 7c = 10
StepโbyโStep Evaluation (Left to Right)
a++โโ uses 5, thenabecomes 6a--โโ uses 6, thenabecomes 5--aโโabecomes 4, uses 4--bโโbbecomes 6, uses 6++cโโcbecomes 11, uses 11--cโโcbecomes 10, uses 10
Substituting the values:
result = 5 + 6 - 4 + 6 - 11 - 10
Calculation:
5 + 6 = 1111 - 4 = 77 + 6 = 1313 - 11 = 22 - 10 = -8
Final Output: -8
What I Learned on Day 6
- Complete understanding of Assignment, Arithmetic, Unary, Relational, and Logical operators.
- Clear difference between
==(equality) and=(assignment). - How Java evaluates preโ and postโincrement operations.
- Why complex unary expressions should be written carefully.
Dayโฏ6 strengthened my understanding of how Java handles values internally and how operators influence program behavior.
Date: 24/02/2026
Trainer: Nantha from Payilagam
A Small Note
I used ChatGPT to help me structure and refine this blog.