Java Programming Lesson 3 | Operators in Java Tutorial
LESSON-3: OPERATORS
📘 Lesson 3 — Operators (Arithmetic, Logical, Relational)
Operators → Symbols used to perform operations on data.
Example:
Here + is an operator
✅ 1️⃣ Arithmetic Operators
Used for math operations:
| Operator | Meaning | Example |
|---|---|---|
+ | Addition | a + b |
- | Subtraction | a - b |
* | Multiplication | a * b |
/ | Division | a / b |
% | Modulus (remainder) | a % b |
✅ Example Code:
✅ 2️⃣ Relational / Comparison Operators
Used to compare values → Output: true / false
| Operator | Meaning | Example |
|---|---|---|
== | Equal to | a == b |
!= | Not equal | a != b |
> | Greater than | a > b |
< | Less than | a < b |
>= | Greater or equal | a >= b |
<= | Less or equal | a <= b |
✅ Example:
✅ 3️⃣ Logical Operators
Used in conditions (true or false)
| Operator | Meaning | Example |
|---|---|---|
&& | AND | (age > 18 && age < 30) |
| ` | ` | |
! | NOT | !(isStudent) |
✔ Logical AND → both true
✔ Logical OR → any one true
✔ NOT reverses truth
✅ Full Practical Example
✅ Output:
🧠 Bonus: Increment / Decrement Operator
| Operator | Meaning |
|---|---|
| ++ | Add 1 |
| -- | Subtract 1 |
📝 Exercise for You (Try Now ✅)
Write a program:
Input:
Output must show:
✅ Sum
✅ Difference
✅ a > b ?
✅ a == b ?
✅ (a > 30 AND b < 25)
Reply with your code + result
I will check and grade it ✅
🎯 Quick Quiz
1️⃣ Which operator gives remainder?
A) /
B) %
C) *
2️⃣ Which operator returns TRUE only when both conditions are TRUE?
A) &&
B) ||
C) !
Reply like:
1 → ?, 2 → ?
✅ Lesson-3 Complete!
Reply with:
✅ Exercise code
✅ Quiz answers
➡ and then we go to Lesson-4: Conditional Statements (if, else, switch) 🚀


No comments
Thank You For Visit My Website.
I Will Contact As Soon As Possible.