Programming in Java
Unit 3: Operators
From arithmetic to bitwise — master every Java operator, understand precedence traps, and build real-world calculators used by fintech companies.
⏱️ Time to Complete: 4 hrs theory + 3 hrs lab | 💰 Earning Potential: ₹5K–₹15K/month | 📝 30 MCQs (Bloom's Mapped)
💼 Jobs this unlocks: Java Developer (₹4–8 LPA) | Fintech Engineer (₹6–12 LPA) | Android Developer (₹5–10 LPA)
Opening Hook — Operators Power India's Biggest Trading Platform
🏢 How Zerodha's P&L Calculator Uses Every Operator You'll Learn Today
Open the Zerodha Kite app and check your Profit & Loss (P&L) statement. Behind that simple green/red number is a symphony of Java operators working in real-time. Arithmetic operators calculate (sellPrice - buyPrice) * quantity. Relational operators check if (profit > 0) to show green vs red. Logical operators determine if (isIntraday && isPositionOpen) for margin calculations. Bitwise operators encode trade flags for high-speed order matching. Ternary operators decide status = (pnl >= 0) ? "PROFIT" : "LOSS".
Zerodha processes over 15 million orders per day — each one evaluated through dozens of operator-based calculations in microseconds. Their matching engine, built in Java, uses operator precedence rules exactly like you'll learn in this chapter. One wrong bracket, one confused ++i vs i++, and millions of rupees could go wrong.
What if YOU built this? What if you understood operators so well that you could build a P&L calculator, a tax engine, or a trading bot? That's exactly what this unit teaches you — operator by operator, trap by trap.
Learning Outcomes — Bloom's Taxonomy Mapped (12 Outcomes)
| Bloom's Level | Learning Outcome |
|---|---|
| 🔵 Remember | LO-1: List all categories of Java operators — arithmetic, relational, logical, bitwise, assignment, unary, and ternary |
| 🔵 Remember | LO-2: State the complete operator precedence table from highest to lowest priority |
| 🟢 Understand | LO-3: Explain the difference between pre-increment (++i) and post-increment (i++) with memory-level reasoning |
| 🟢 Understand | LO-4: Describe how short-circuit evaluation works in && and || and why it matters for null-safe code |
| 🟡 Apply | LO-5: Write Java programs using all operator types to solve real calculation problems |
| 🟡 Apply | LO-6: Use the ternary operator and instanceof to write concise conditional logic |
| 🟠 Analyze | LO-7: Trace complex expressions involving mixed operators and predict exact output (interview-level) |
| 🟠 Analyze | LO-8: Analyze bitwise operations to understand how flags, masks, and permissions work in system code |
| 🔴 Evaluate | LO-9: Evaluate when to use bitwise vs logical operators and justify trade-offs in performance-critical code |
| 🔴 Evaluate | LO-10: Judge common operator-related bugs (= vs ==, precedence errors) and propose fixes |
| 🟣 Create | LO-11: Build a complete Zerodha-style P&L calculator using all operator types |
| 🟣 Create | LO-12: Design a permission system using bitwise operators, similar to Unix file permissions |